I am developing application where I want to implement push notification for that I am using GCM, I have registered my project on google console and using project ID as sende
Here is a working example for push notifications, hope this helps:
private String SENDER_ID = "xxxxxxx";
private GoogleCloudMessaging gcm;
//somewhere else
gcm = GoogleCloudMessaging.getInstance(context);
String msg = gcm.register(SENDER_ID);
I recently got some service not available errors here so I also implemented a Broadcastreciever to recieve the regestration token.
@Override
public void onReceive(Context context, Intent intent) {
Bundle data = intent.getExtras();
if (data!=null){
String regId = data.getString("registration_id");
}
}