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
SENDER_ID = Project Number, I was using Project Id.. Project Number is available on console beside project id.
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");
}
}
Google has changed its layout. you can find project_number from here
select project -> My Project
click three dots -> Project Information -> Project Number
I got same error and found out that google login was not enabled in firebase console. After enabling it error was gone.
Check this image for reference: