INVALID_SENDER error at GCM registration

前端 未结 4 994
攒了一身酷
攒了一身酷 2021-01-19 10:11

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

相关标签:
4条回答
  • 2021-01-19 10:15

    SENDER_ID = Project Number, I was using Project Id.. Project Number is available on console beside project id.

    0 讨论(0)
  • 2021-01-19 10:19

    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");
        }
    }
    
    0 讨论(0)
  • 2021-01-19 10:33

    Google has changed its layout. you can find project_number from here

    select project -> My Project

    click three dots -> Project Information -> Project Number

    0 讨论(0)
  • 2021-01-19 10:38

    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:

    0 讨论(0)
提交回复
热议问题