1
votes

I am facing a serious issue using GCM. Earlier we used to send push notification using UrbanAirship which sends push messages using GCM. Now we have implemented our own GCM on Client and Server and want to send push notifications using only GCM. Since some of the users will be using the old version of the application and might not have updated to new one, we have to keep using UrbanAirship to send notifications to them. The users who have updated the app will get the push messages through gcm ONLY. This was tested on debug mode and worked fine.When push messages were sent through UrbanAirship, it was not received by those devices in which new build was installed.

But on live server, when we tried to send push message the users who had updated the app and were with us since inception, (who used to receive push messages through UrbanAirship) received push messages from GCM as well as UrbanAirship. The push message sent via GCM contained the message but the message sent via UrbanAirship was blank. The same thing did not happen on those devices which installed the app for the first time. Those users received push message only via GCM.

I believe the reason for this is that UrbanAirship still had the device_ids for those devices which used to receive push messages via UrbanAirship. Now, the permission used by activities handling the broadcast for GCM and UrbanAirship is same, they both respond to same action in the intent-filter. Thus, even though the activity for UrbanAirship was removed from the manifest file, the message was handled by the activity which handles GCM Push message.

Is there a way to prevent UrbanAirship from sending push messages to those devices which usedd to receive Notifications via UrbanAirship? or unregister those devices from UrbanAirship? Or can I modify the receiver for GCM by passing an extra parameter which if not recognized in the app, won't create push notification?

1
Does the UrbanAirship API offer a unregister method to remove the device from the UrbanAirship registration database?mjn

1 Answers

1
votes

You can register your device by sending hashed id for you device by :

UAirship.shared().getPushManager().getNamedUser().setId(msisdn)

and unregister by setting the named user = null:

UAirship.shared().getPushManager().getNamedUser().setId(null);