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

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.

Related

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"

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.

Knowing if an app is authorized to receive push notifications on-the-fly

Consider this situation. The app runs and application:didRegisterForRemoteNotificationsWithDeviceToken: receives information that the app is authorized to receive push notifications.
User puts app to background and removes app's authorization to receive notifications on the device's configuration.
User runs app again. Returning from background, the app still thinks it has authorization to receive push notifications. Neither application:didRegisterForRemoteNotificationsWithDeviceToken: or application:didFailToRegisterForRemoteNotificationsWithError: receives anything at this point.
Is there a way to know at any given point if an app has authorization to receive push notifications (reading something from device's notification preferences)?
thanks.
You can check for [[UIApplication sharedApplication] enabledRemoteNotificationTypes] each time the app returns from background.
See: iOS - Check for push notification support in the app
Once I have verified that the user has it disabled is there a way to programmatically direct the user to the notification settings on the device's configuration?
No for newer iOS versions. According to Navigate to settings screen in iphone and iOS Launching Settings -> Restrictions URL Scheme, you can use -[[UIApplication sharedApplication] openURL:] to navigate to settings screen, but only on devices running iOS version 5.0 and prior.

Apple Push Notification Registration & Device Token Receive clarification?

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.

How Apple Push Notifications Deliver to the User in iPhone app?

Am developing an iPhone app. In my current iPhone app i want to integrate APNS that we want to send a messages to the user. I gathered information about APNS. But, still i have some doubts on the APNS.
How APN works that means how the push notifications showing to the user?
If our iPhone app get closed from Background, the Apple push notification will work or our app should be in run?
What will happen if we send a notification to the user but,if the user is in offline. The message will deliver to the user once the user gets online (Get network connection) or the message won't show to the user?
Push Notifications will be show the user if the user doesn't open the app in their iPhone?
Can anyone please guide me on these doubts? I hope on you friends. Please help me. Thanks in advance.
I think you did not follow Apple developer library instructions. I have doubts about your understanding of APNS and its working.
When you send the notification to user, and his cell is off or not connected to the internet, he/she will get message/notification when his/her cell will turn on or connect to the network.
And Push Notifications also work when your application is in backGround or user is not using the application.
Hope this information can clear your confusion, you should look in to the apple developer videos and SDK about push notifications.
Also this is SOreadytohelp.
You asked quite a few questions. I'll try to answer some of them as well as I know:
How APN works: You send a message to Apple's servers with the specific device ID. Apple will deliver that message to the iOS device. (You likely want a more specific answer, so please ask.)
If your app has been allowed background app notifications, then they will be delivered in the background. (The user can enable/disable this)
If the particular iOS device is not connected to the network, notifications will be queued. But, identical notifications will get discarded and only the most recent will get delivered. See: Quality of Service
Yes (basically the same answer for 2).