What is authorizedEntity? Can't find gcm_defaultSenderId in own app

后端 未结 2 548
夕颜
夕颜 2021-02-11 19:00

I am trying to get my app running with Google Cloud Messaging. I am following the Google Cloud Messaging Quickstart App which can be found here on github.

In their quick

2条回答
  •  清歌不尽
    2021-02-11 19:36

    It is the project id that we need to fill in place of that string. Please refer to the following link.

    https://developers.google.com/instance-id/guides/android-implementation

    Generating tokens requires a Project ID generated by the Google Developers Console.

    String authorizedEntity = PROJECT_ID; // Project id from Google Developers Console
    String scope = “GCM”; // e.g. communicating using GCM, but you can use any
                          // URL-safe characters up to a maximum of 1000, or
                          // you can also leave it blank.
    String token = InstanceID.getInstance().getToken(authorizedEntity,scope);
    

提交回复
热议问题