pusher / push-notifications-swift

Swift SDK for the Pusher Beams product:
https://www.pusher.com/beams
MIT License
34 stars 24 forks source link

No way to tell if device already registered #118

Closed jhumphrey1 closed 5 years ago

jhumphrey1 commented 5 years ago

In the Android library, when PushNotifications.shared.start is called with an instance ID that is different from the instance ID that was previously registered, an error is raised which can be caught and then displayed to the user. (Eg. uninstall/reinstall the app).

Currently, when .start fails, it does not raise any exceptions, although it does log that the device has already been registered.

jhumphrey1 commented 5 years ago

The message: [PushNotifications]: This device has already been registered with Pusher. Push Notifications application with instance id: {OLD_PUSHER_ID}. If you would like to register this device to {NEW_PUSHER_ID} please reinstall the application.

lukabratos commented 5 years ago

Hi @jhumphrey1

You could check whether the app is currently registered for remote notifications by using isRegisteredForRemoteNotifications. If the result is true you can safely assume that device successfully registered with Pusher.

jhumphrey1 commented 5 years ago

After testing, this isn't the case. The app is currently in the state where the message above shows, but calling isRegisteredForRemoteNotifications returns true. This can be recreated by having a device set up with PushNotifications.shared.start(instanceId: "{OLD_PUSHER_ID}"), changing the pusher id to NEW_PUSHER_ID, and pushing an app update to the device without uninstalling/reinstalling. The device is registered for remote notifications, but in the console the above message is printed

lukabratos commented 5 years ago

We're not completely sure what you intend to do so please answer the following questions:

jhumphrey1 commented 5 years ago

We have a production application released in the store to users with a pusher instance id. Architecture changes, and we need to change to a different pusher account with a different pusher id, without uninstalling and reinstalling the application on every end user's device.

lukabratos commented 5 years ago

Our suggestion is that you use previous (old) instance id and you add the new account as a colaborator for that instance.

We don't currently support multiple instances in the same app.

If you'll have any follow-up questions please contact our support, they'll be happy to help you further: support@pusher.com