Push notification dialog not appearing anymore (unable to get device token)

When you start an app for the first time on an iPhone, iOS automatically asks "Allow this app to send push notifications? " and if you say “Yes” the app can know the device token of the phone.

This used to happen for our Corona app. But we changed push certificate, and the push messages are still delivered just fine (using device tokens detected with the old push certificate), but we don’t get “notification” event from Corona anymore when trying the app on new phones, so we can’t get more device tokens.

Anyone who can pinpoint the problem?

[import]uid: 73434 topic_id: 34207 reply_id: 334207[/import]

Don’t consider me an authority on this and you probably should consult google for an answer. But I needed to get my device ID on an app after I had already done the registration process, and there was something about you having to remove the app from the device for at least 24 hours and then the device will re-prompt you to register.

I think the device remembers the bundle ID and not so much the cert and provisioning profile.
[import]uid: 199310 topic_id: 34207 reply_id: 136079[/import]

@Rob Miracle: Did some testing. The problem is not the certificate, but this: When rejecting (or accepting for that matter) push on a phone, I am not asked about accepting or rejecting ever again, even if I have deleted the app for 24 hours.

This is problematic: If a user rejects push, and later realizes he wants it, there is no way for him to ever get it.

Native iOS implements unregisterForRemoteNotifications. Does Corona have any way to do this, or otherwise force the push dialog to appear again?
[import]uid: 73434 topic_id: 34207 reply_id: 136319[/import]

Don’t consider me an authority on this and you probably should consult google for an answer. But I needed to get my device ID on an app after I had already done the registration process, and there was something about you having to remove the app from the device for at least 24 hours and then the device will re-prompt you to register.

I think the device remembers the bundle ID and not so much the cert and provisioning profile.
[import]uid: 199310 topic_id: 34207 reply_id: 136079[/import]

@Rob Miracle: Did some testing. The problem is not the certificate, but this: When rejecting (or accepting for that matter) push on a phone, I am not asked about accepting or rejecting ever again, even if I have deleted the app for 24 hours.

This is problematic: If a user rejects push, and later realizes he wants it, there is no way for him to ever get it.

Native iOS implements unregisterForRemoteNotifications. Does Corona have any way to do this, or otherwise force the push dialog to appear again?
[import]uid: 73434 topic_id: 34207 reply_id: 136319[/import]

@Rob: Any news on this? How can I make (or encourage) the native iOS “Accept Push” dialog to reappear to the user?
[import]uid: 73434 topic_id: 34207 reply_id: 137926[/import]

The data concerning your app (as far as push is concerned) is still stored on the device in the OS somewhere. I believe the only way to clear it is to reset the entire device.

I recently setup a new iPhone and used iCloud to restore it. The original device no longer had Words with Friends installed when it backed up. Though on the new device, after restoring, lists the game under notifications in settings. I can turn push on and off even though there is no app or profile for the game. So it must be stored in the OS settings somewhere.

Also any installed app that is setup for push, whether they declined the initial message or not, should have it listed in the settings-> notifications section of the device. In there you can turn the push on or off manually.

[import]uid: 56820 topic_id: 34207 reply_id: 137970[/import]

@Rob @Josh: Please, do you know anything about this?

If the user says “No” to the initial “Do you want Push Notifications for this app?” dialog, does the app forever lose its chance of getting the Device Token?

Some say the dialog will re-appear if uninstalling, waiting 24 hours, and installing again. I tried this, and the dialog did not appear.

Is it possible to call some iOS function that will remove the “The user has been asked about push” boolean and make the dialog reappear? If so, could it be supported in Corona?

Some guy here said you actually have to factory reset the device. I hope this is a joke.

[import]uid: 73434 topic_id: 34207 reply_id: 138143[/import]

My main answer was how to turn push on and off after the popup was already asked. If your app is installed, it will be listed under settings->notifications. The original popup has no reason to be asked again. The setting can be changed under settings.

Whenever you run an app for the first time, that is push enabled, you should get the remoteNotification event. That should happen even if you uninstall and then reinstall right away. Think of the popup as simply a courtesy the first time the app is installed on a device. It simply asks whether you want it turned on or off in settings->notifications. It doesn’t stop the app from ever being used with push if the user later turns it on. So to get that popup again you would need to reset the device so it has no record of it being installed prior.

If you are not getting a remoteNotification on the new devices I would suspect your new certificate is not setup correctly. Any phone which had the app installed at any time prior is most likely getting the device token because it was given previously. Either Apple just reissues it or iOS has it saved somewhere and it has not expired.

From the blog by Corona it says the following and does not state what happens if something is wrong. It would be logical that you would not get the remoteNotification at all.

At this time, your app will then contact the Apple Push Notification Service (APNS) and if the provisioning profiles, certificates, etc. are good to go, then you’ll get back a device token. This is a unique string that’s needed for your own server to send push notifications to the specific device that the token is associated with.

[import]uid: 56820 topic_id: 34207 reply_id: 138166[/import]

Please visit this Apple techdoc:

http://developer.apple.com/library/ios/#technotes/tn2265/_index.html

And go to the tips and tricks. They explain how to reset it. [import]uid: 199310 topic_id: 34207 reply_id: 138178[/import]

I just want to point out that my experience with those procedures, just like with olav.morkrid, didn’t work. The popup never returned. Maybe a bug with iOS 6 or maybe the iPhone 4. That’s what I tried it on. [import]uid: 56820 topic_id: 34207 reply_id: 138191[/import]

did you try the set the clock ahead a couple of days trick? [import]uid: 199310 topic_id: 34207 reply_id: 138194[/import]

Yeah I tried that trick first. Waiting 24 hrs was silly for me when I am using test devices that can be reset within minutes. Later I did try 24 hours but it didn’t work.

For curiousity’s sake I have deleted my test app again and will wait 48 hours. For me it’s still faster to just reset, however I understand for other situations an alternative solution would be better. I hope it works giving it more time. [import]uid: 56820 topic_id: 34207 reply_id: 138327[/import]

Oh on the subject of tokens, quick question Rob. I never have taken into consideration the expiration of the token. I have read it can expire after a couple years on it’s own. That’s hard to test in a real world scenerio given the time needed. Do you know what happens when it expires? Will our app just receive another remoteRegistration with a new token? [import]uid: 56820 topic_id: 34207 reply_id: 138330[/import]

Just on the outside chance, you are:

  1. deleting the app
  2. setting the clock forward in time
  3. Installing the app

As for the 2nd question, I have no idea. [import]uid: 199310 topic_id: 34207 reply_id: 138388[/import]

We tested on several devices and were always able to get the “remoteRegistration” event even if we selected “Don’t Allow” on the initial dialog. We just went into “Settings / Notifications”, allowed notifications and when we next opened the app, the “remoteRegistration” message arrived.

I fear that we’re not truly reproducing your issue but it might also be that the issue is an artifact of your testing environment. If you have any more suggestions on how to test this I’d love to hear them. [import]uid: 199237 topic_id: 34207 reply_id: 138394[/import]

@Rob: Any news on this? How can I make (or encourage) the native iOS “Accept Push” dialog to reappear to the user?
[import]uid: 73434 topic_id: 34207 reply_id: 137926[/import]

The data concerning your app (as far as push is concerned) is still stored on the device in the OS somewhere. I believe the only way to clear it is to reset the entire device.

I recently setup a new iPhone and used iCloud to restore it. The original device no longer had Words with Friends installed when it backed up. Though on the new device, after restoring, lists the game under notifications in settings. I can turn push on and off even though there is no app or profile for the game. So it must be stored in the OS settings somewhere.

Also any installed app that is setup for push, whether they declined the initial message or not, should have it listed in the settings-> notifications section of the device. In there you can turn the push on or off manually.

[import]uid: 56820 topic_id: 34207 reply_id: 137970[/import]

@Perry: Your posting was the most clarifying and reassuring so far. You’re basically stating that the device token is not “lost” upon initial rejection via the dialog, which is a relief, and so the problem must be elsewhere. The phone UDIDs are all added to the development provisioning profile, so then I just don’t know.

@anderoth: Yes: The last time I tried rejecting the dialog, I didn’t get any “remoteRegistration” event at all. What conclusions can we draw from this? [import]uid: 73434 topic_id: 34207 reply_id: 138572[/import]

@Rob @Josh: Please, do you know anything about this?

If the user says “No” to the initial “Do you want Push Notifications for this app?” dialog, does the app forever lose its chance of getting the Device Token?

Some say the dialog will re-appear if uninstalling, waiting 24 hours, and installing again. I tried this, and the dialog did not appear.

Is it possible to call some iOS function that will remove the “The user has been asked about push” boolean and make the dialog reappear? If so, could it be supported in Corona?

Some guy here said you actually have to factory reset the device. I hope this is a joke.

[import]uid: 73434 topic_id: 34207 reply_id: 138143[/import]