Registering on iOS 9 #238

Closed
alexbuijs opened this Issue Oct 19, 2015 · 6 comments

Projects

None yet

2 participants

@alexbuijs

Hi, thanks for this awesome plugin!

I noticed the following weird behaviour on iOS 9.0.2 and version 1.3.0 of this plugin (i'm not sure if this happens on earlier versions of iOS as well). Also it only happens about 50% of the time.

Steps to reproduce:

  • new install app with this plugin
  • call PushNotification.init with options
  • don't accept or deny notifications when system popup is shown

Result (about 50% of the time):

  • the registration event is called with a token!
  • when the used accepts, the registration event is called again!

When the user chooses to reject notifications, of course messages won't arrive. When he later turns them on in the settings app, they will arrive with the previous obtained token.

The problem is that my app cannot reliably know if registration was successful or not, since It is possible a token is registered and a moment later the user chooses not to allow notifications... Also, it is undesirable that the registration event is called twice when the user accepts them.

@macdonst
Member

@alexbuijs it was fixed by PR #215 which is in master and will be part of the 1.4.0 release I hope to get out this week.

@macdonst macdonst closed this Oct 19, 2015
@alexbuijs

I missed that. Great, thanks!

@alexbuijs

I tested again with the master branch. Unfortunately, the original problem is not solved. It did solve the re-registering problem! But the fact that the plugin some (most) of the time registers before waiting for the result of the system popup, is still a problem, imo.

@alexbuijs

@macdonst can you confirm this is still an issue and reopen it?

@macdonst
Member

@alexbuijs are you using PhoneGap Build? If so please comment on issue #201

@alexbuijs

@macdonst No, I'm using plain cordova, most recent version. Actually, what this issue was about, is described here: http://stackoverflow.com/questions/11045406/apple-push-notification-registration-device-token-receive-clarification. So didRegisterForRemoteNotificationsWithDeviceToken is called with a token, whether the user allows notifications or not. I reckon there is not much you can do about this. My workaround is calling init at different points in time. Because when a user disallows notifications, the registration event will not be called a second time, when calling init again. (Which can be registered with a timeout).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment