Get GCM canonical registration ID without sending a message

后端 未结 3 653
眼角桃花
眼角桃花 2021-02-06 05:12

I have a problem with an app using GCM, the scenario is this:

  1. the app is installed
  2. the app calls the GCM register method getting the registration id \"RID
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-06 05:53

    If all you need is that the user should not get a notification, send a message with parameters that your application is not looking for. You will get the canonical and your app will discard the notification if it does not have the mandatory text and message.

    For example, my Cordova application plugin requires the key 'message' in the data received from the server. Otherwise it does not create a notification.

    I know this is sort of a hack, but I think given the limitations, this will be the easiest to achieve.

提交回复
热议问题