Apple Push Notification Registration & Device Token Receive clarification? - iphone

I am working on an iPhone app with Apple Push Notification integration. I have some doubts on this.
If the user clicked "Dont Allow" button in the APNS registration alert, will our code still receives the Device Token from APNS?
I have tested that when the user switched off the notification in iPhone notification, still the app receives the Device Token from APNS? It is correct?
Can anyone please clarify these doubts?

In my understanding on APNS, it doesn't depend on the user's action (as you mentioned that if when the user clicks on "Don't Allow" button) for your iOS to receive the Device Token.
If you included in your app:
- (void)application:didRegisterForRemoteNotificationsWithDeviceToken
This means that your iOS-based app is sending a request for Push Notification registration. In return, Apple sends the Device Token to the iOS; then the iOS sends the token to the app and then the app sends it to their service provider.
Note that when the user is asked "Don't Allow" doesn't mean that you're not going to receive the device token. "Don't Allow" refers to the action to be taken to any notification received by the app that is intended for the user. Say, location. This is a whole different thing. This means that the user doesn't allow the app to use his/her location.
Yes. it still receives the Device Token as what I have discussed in my answer to your question in #1.
This is only a setting for your app, which means that you won't be receiving any visible notification (badge, message or a sound) whenever there are updates about any information in relevance to your application. It's like setting your Facebook account to only receive notifications when your friends sends you a private message. Other than that, you won't be notified at all.
The process of enabling APNS is:
Request for certificate Authority
Create app id
Configuring AppId for Push Notifications
Create provisioning profile
Provisioning a device
Enabling the profile in Xcode
Creating push notification provider.
For more understanding on APNS, check this out.

I have tested with Xcode 6.1, ios8.1.2. Currently the device token will be generated only in two cases
Apple's default consent with "Ok" option
After "Dont allow", manual change in Setting->Notifications->app->AllowNotification(On)
By declining first time with apple's consent, will not generate device token, till manually change the value in settings page.

Related

is there a way to check if user is currently "signed in with apple" in flutter app?

I have a flutter app with 2 authentication methods:
Based on device id (associated with account during account creation)
Sign in with apple
I need to know whether user is currently signed in with apple on each app launch.
Why I need that:
When device id is not found in my back end, I send user to registration page, where user has 2 options to register:
regular registration
sign in with apple
The problem is that device id can be changed on ios upgrade, app reinstall etc. Therefore if user signed in with apple first time, but then his device id has changed, I want to remove sign in with apple button. Because for that particular case user is supposed to go through regular sign in method where he needs to enter phone number he entered during the registration and if he confirms SMS code, then account is linked to new device id and access is restored. I don't want them to click sign in with apple again, because during regular sign ins I only get tokens from apple and can't get apple id email anymore.
Hopefully that makes sense.
Thank you

Delete app data from test device (iPhone)

I'm trying to delete the user's login credentials and push notifications permissions from my test iPhone 4.
When I delete the app, it still remembers the user's login credentials, and it doesn't reset the push notification opt-in permissions.
How can I reset this data?
These are two separate problems.
For the login problem, sounds like you're storing the user's login credentials on the keychain. The only way to wipe this out is to either do it via code, logging out and then deleting the app, or doing a factory reset on the device.
About resetting the push notification status, it's mentioned in an Apple Technical Note here:
https://developer.apple.com/library/ios/technotes/tn2265/_index.html
Scroll down to "Resetting the Push Notifications Permissions Alert on iOS"

will push notifications work if user has neither allowed nor "not allowed" push notifications for my app yet?

I am currently updating my App, and I am planning on including Push notifications.
The main purpose for my push notification is to let users know that the app has been updated and they should check out the new features. Now with iOS7 automatically updating apps, users are less likely to open apps after they have been updated, let alone KNOW it has been updated. As a lot of users will just clear their notification centre's with out paying any attention.
So my question is...if a user has not launched my app yet to see the alert "[myApp] would like to send you Push Notifications" - Don't Allow / OK.
Will they see my push notification before they have had chance to allow or not allow?
Do push notifications work until "not allowed" has been pressed? Or do they not work until OK has been pressed???
Thanks for your help.
If they never launched your app, your app never registered to Apple Push Notifications on their device, so you can't send them push notifications.
In addition, your server is not likely to have the device token for a device in which your app was never launched (since it's the app's job to send the device token to your server).
And if you push a notification to a device token of a device on which your app never registered to push notifications, the notification won't be delivered (even if the app is installed on the device), and that device token will eventually be returned to you in the feedback service.

Is it possible to get the device token even if Push Notification is not enabled?

I need to get the device token because I will use it for autologin. However, if the user did not allow Push Notifications from my App in his/her device, I will not be able to get the device token. I want to know if it's possible to get and store the user's device token even if he/she did not enable APN. Thanks.
Enabling/Disabling the push notification is just a setting. It doesn't stop the device from receiving the access token from APPLE
Check #Kimpoy's answer including the comments.
In my understanding on APNS, it doesn't depend on the user's action (as you mentioned that if when the user clicks on Don't Allow button) for your iOS to receive the Device Token.
If you included in your app:
- (void)application:didRegisterForRemoteNotificationsWithDeviceToken
This means that your iOS-based app is sending a request for Push Notification registration. In return, Apple sends the Device Token to the iOS; then the iOS sends the token to the app and then the app sends it to their service provider.
Not that when the user is asked "Don't Allow" doesn't mean that you're not going to receive the device token. Don't Allow refers to the action to be taken to any notification received by the app that is intended for the user. Say, location. This is a whole different thing. This means that the user doesn't allow the app to use his/her location.
Yes, it still receives the Device Token as what I have discussed in my answer to your question in #1. This is only a setting for your app, which means that you won't be receiving any visible notification (badge, message or a sound) whenever there are updates about any information in relevance to your application. It's like setting your Facebook account to only receive notifications when your friends sends you a private message. Other than that, you won't be notified at all.
The process of enabling APNS is:
Request for certificate Authority
Create app id
Configuring AppId for Push Notifications
Create provisioning profile
Provisioning a device
Enabling the profile in Xcode
Creating push notification provider.
For more understanding on APNS, check out this.
You still can get the device token even if the user disables it.

iPhone Apple Push Notification service

When i log in to iPhone developer programmer portal as admin, if go to App Id section
i can see list of app id's.I want to enable for push notification.But in Action column there is nothing i am not getting configurable button. So i am not able to proceed further to get SSL certificate for my app.
In order to enable the Push Notification Service, you must set the explicit name for your App ID, not the wildcard asterisk character. See the iPhone Developer program user guide for more information.