push notification - Android Gcm Unregister Users Subscribed To A Topic When App Uninstalled -
scenario: have 3rd-party app server, gcm http connection server, , android app setup push notifications. when user uninstalls app, can delete them 3rd-party server sending (no-longer-valid) registration id push notification , handling "notregistered"
error returned gcm connection server.
however, similar approach not seem work when send push notification users subscribed "topic", here gcm connection server returns json object "message_id"
.
the notable columns in 3rd-party server database table follows:
| gcmregistrationid (string) | subscribedtonotificationtopic (boolean) |
does know how identify user has set true
in subscribedtonotificationtopic
column, uninstalled app?
i have idea on how resolve this, seems messy.
every often, instead of sending push notifications topic e.g.
{ "to" : "/topics/global", ... }
send push notification registration ids of users subscribed topic e.g.
{ "registration_ids" : {list of registration ids}, ... }
such can retrieve , handle
"notregistered"
errors.
the problem however, multicast messaging has limit of 1000 users i'd have send message each thousand.
this seems bad practice (especially if there more 1 topic involved), maybe it's way?
(extra tags: topic messaging, pubsub, unregister, google cloud messaging)
first off, not sure correct assume "notregistered" error can result of user uninstalling app. seems device can become unregistered if device receives message message can not delivered. can happen if user stops app (which different uninstalling it, or if app killed , remains stopped due power saving mode.
https://developers.google.com/cloud-messaging/ccs#response
if notregistered, should remove registration id server database because application uninstalled device, or client app isn't configured receive messages.
what can device side, periodically register device, , make sure token same 1 stored, if not update server new token.
as far detecting if user has uninstalled app via response topic message, agree not seem directly possible. alternative proposed solution, might, every , include flag in topic message ask device validate server, if device not validate after number of attempts or period of time might conclude user not longer listening.
the other question why need know. there harm in sending regid's google? if user quits web service can remove them list, need take action if un-install app there device? - thing consider. hope helps.
Comments
Post a Comment