UPDATE: I fixed the problems in the code below so this makes a nice basic working example of how to use GCM
So, I\'m trying to im
I think you have some issues in the code.
You should do the registration of your own broadcast receiver in the manifest file and that receiver will trigger the .
Therefore you must do something like I write below.
The receiver must be declared like:
Your broadcast receiver that will start the service.
public class YourBroadCastReceiver extends BroadcastReceiver {
@Override
public final void onReceive(Context context, Intent intent) {
GCMIntentService .runIntentInService(context, intent);
setResult(Activity.RESULT_OK, null, null);
}
}
I advice you to take a look at the official GCM documentation where you can find a good example.
And... don't forget to enable the Google Cloud Messaging service in the main Google APIs Console page.
Let me know if it helps!