android - User Notifications - How to recover a lost notification_id from GCM? -



android - User Notifications - How to recover a lost notification_id from GCM? -

i generate notification_keys described here.

suppose due error fail store it, seek re-register. time receive 400 error message "notification_key exists". looks odd, compared registration of device gcm, can register many times want , same registration id status 200. can't register again, , can't unregister, because don't have notification_id. is there way generated notification_key gcm? or way register 1 time again different notification_key_name?

based on docs, there no way gcm notification_key of existing notification_key_name. if think it, makes sense trying create new notification_key existing notification_key_name give error, since if wasn't case, might accidentally overwriting registration ids of existing notification_key if happen supply existing notification_key_name mistake.

you comparing registering device gcm multiple times, each time getting same registration id, it's not similar situation. when register device gcm, gcm has way identify device , know registered , homecoming same registration id. user notifications, has notification_key_name supplied, , there's nil stopping using same notification_key_name multiple users. is, there stopping - error got when trying create notification_key used notification_key_name.

an easy way overcome problem treat notification_key_name unique identifier generated server. if don't have notification_key user (either because it's new user or because failed store notification_key got google), generate new unique notification_key_name , utilize create new notification_key. don't have care old notification_key failed store.

finally store both notification_key , notification_key_name in table contains user id.

android push-notification google-cloud-messaging android-notifications

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -