Start a new topic

Device Token problem

Hi,



I only have two Android devices, but I see this in the Push field of my user record. Why so many GCM tokens?



{ "GCM": { "ids": [

"APA91bEfc5fA2H7zdFXk7wDCmbPGCx2lH_mapm1cg_f8SPK_87Ejgz6gFkJ_2YKv9PKD0XEHSmUoH6Cy4YHYrhNzeF3G93qpNfI7FG3Blchrj14ohtEOiR9V-GvVqkAmwd3Ra_ClfKXHPUv_-JksD4w0hp7RbEZfug",

"APA91bHE8zeTeAoAvzZ5iec7MKohtXFtuQgbRH5nrQ6L8B1ghxahxKaImo_3CMU0KNjNjhqBdtFKPApu_KvnbaWQ93GVokXXTR139izmrHR9_pMHlNwK6rGlFPNaWCYLYecXS_86ElEvcWsglL5QcRaaM-ae8XxwUA",

"APA91bEkyvxb00EaZazWpS4-xRWZe7FZ6mFimor1EMQSZZkntGQc_T5MzQ9hFKzN2kwhtUrcxYejV-nv0dmWRy6k1Yu1iPGamUN4ktlYJV2ZnwqS687oDcVM8b4LGxye9y5aL-2XMMb0iDv2idsUd4IVGvoejxiOag",

"APA91bE14SQGPVGKiVHtrlXngyEdj7m4SDChnlkJ_fTFuIbYKXKQgrDTWjU6SZVek_9zxWj6o-T82kcUwNSQJTggdKNDSZncXGPgJ2eJ1bn26QbhIfV7Z0TZtZ85KOU6BBLHCB_sxB8kN4yN3YUCwnFPK9sPVXnofA",

"APA91bFjMleacCNhNglSl3PFa2dM5y-by52PbpRi7YBNwizidMgiT31RAWnUKKz2ioB4bamJ4WevsjtzwOXUx1zJuunEgilOt7IXkOev6ijsGGuZUhT6IzfSDH0LHVejE9UOU7O06k62IXtA_N96RauJ4oGsel9Gng",

"APA91bGrIlRvdCiM9_Et33Jo_JVMXswnOchdTgoRYjyfudlmgEYZh-jUGwXraD65T3zyXnCYtypcN_2BOka82l3j4lGdnVTsabiQShKmftWjPqdyhL0RKmjUvmwXxj_JG5RcLcmAD8-lBmaud6rVOdQRFPB5H0YqEA",

"APA91bEqZptdGi7nNAGc2Qdz8eNj4AVql2xNItxbmU1kvZsVcShiJ6jpJFF7LFDH05BADhzJ9frFE1XdIIu18J6l2VWNf6vmCSrzAY2WZbHxxz2zMf8uCrEWFYH14FM67pgI4WRTfyafc6yjqgJTOx-eZ7JqPlmkiw" ] },

"_devicetokens": [ "d1b310c0f71e29ea22ef37b1b9f188101ea474b375642bdde331036733408898" ] }



PS, I'm getting multiple notifications for each push.

Hey,



are you using the same user (username/password) on different devices and registering on each of them? Or have there been changes to the package name of your application?



Note the above behavior is what's expected if the same user has registered on multiple devices, but as you are only using two there should only be two in that array.



According to this: http://developer.android.com/google/gcm/gcm.html the registration id should be unique per app and device-- so even repeated calls to register on the same device with the same package name should have the same push registration id.
>are you using the same user (username/password) on different devices and registering on each of them?



Yes



>Or have there been changes to the package name of your application?



Yes



Also I have un-installed and reinstalled the app. I believe each un-install/re-install cycle gets a new token.



>Note the above behavior is what's expected if the same user has registered on multiple devices, but as you are only using two there should only be two in that array.



Yes, I agree, there should only be two tokens.
Hey.



Just to confirm-- the device token is unique per (physical device AND package name). If you have changed the package name and changed the devices, that would explain why there are multiple tokens.



As a workaround, you can either delete the users and re-create them with empty push fields, and re-register them or you can use business logic to modify the user collection and remove values in the user's `_push` field. This guide here will point you in the right direction for using the `CollectionAccess` module of BL: http://devcenter.kinvey.com/rest/guides/business-logic#Mergingdataintwocollections



Yeah, so the problem is that unregistering for GCM requires the Application context, which would require you to build the app with the invalid package names on the same devices.
Login or Signup to post a comment