Client Disabled Push Notifications on iPhone - iphone

If the client disabled push notifications, can he still receive notifications while the app is running? I read somewhere that if the notification doesn't specify "aps" as the namespace, it'll still go through despite the fact that push notifications have been disabled. The notifications of course will not appear if the app isn't in the foreground. I can't find the article so I can't say for sure this is true.

If your client has disabled push notification in the app you should check this and alert him that your app may not run as expected only till he will enable push notifications again.

I just tested this, nope. Push notifications for active app status will not go through if push notifications are disabled.

Related

Disable push notifications programmatically

I'm looking for a way to disable push notifications when the user logs out of the app.
As the user can do this without an internet connection it is not an option to notify the server that this device should no longer receive notifications.
I figured it out thanks to #wsnjy.
The following code disables notifications:
UIApplication.shared.unregisterForRemoteNotifications()

Push notification data when app is not running?

When the app is not running and user receives, say 5 push notifications, are those push notifications saved somewhere? Or is that data gone? I need to access all 5 push notifications when the app runs the next time.
To clarify, I already understand that you can access the push notification that caused the app to run. What I'm asking is to get all push notifications since the app got terminated.
The APNS service will only retain the most recent pushed message to a device - assuming there is still at least one other app installed AND the user allows push notifications for it, then this one stored message will be delivered the next time the user has an Internet connection.
For better information on the quality of service that Apple has implemented for the APNS service, see my other answer here:
Clarification on Apple APNS

any option to know if apple app get the push notification?

I build xcode app that get push notification, the main problem is that the push notification is very critical for me.
so I want to check if the push notification is delivered to the device with the app installed, I understand that if the iphone dosn't have internet connecction / 3G the push notification is not getting to the device.
how can I check if the device get the notification or not?
how can I check if the APNS successful to deliver the push notification?
I want to send sms if the push notification is not deliver to the device so I think about the idea to get the notification event when it's open by the push notification, and to send request to my server so i can know if the push notification is successful deliver or not. the main problem is that the user need to open the app every time he get the notification and in the night it's a problem. so this option is not good for me.
I check the feedback server push notification but i don't find any info that I can get if the push notification is delivered or not
any idea??
With iOS7 you have a new method called
application:didReceiveRemoteNotification:fetchCompletionHandler:
which you probably could use for your task. From Apple's Docs:
Implement this method if your app supports the remote-notification background mode.
...
When a push notification arrives, the system displays the notification to the user and
launches the app in the background (if needed) so that it can call this method. Use this
method to download any data related to the push notification. When your method is done,
call the block in the handler parameter.
Unlike the application:didReceiveRemoteNotification: method, which is called only when
your app is running, the system calls this method regardless of the state of your app.
The short answer, you can't, since APNS is one way. However, since an app can execute arbitrary code upon receipt of a notification, you can use this to say, send an http request to your own server when the notification is recieved.
There are any number of reason why push notifications might not get delivered to your user, or might not be delivered in a timely manner. Apple does not provide any mechanism for you to query the status of a push notification that you have sent.
If your app is currently running on the user's device and the user is accepting notifications for your app, you can implement the following method in your app delegate. It would be called whenever a push notification is received and in this method you could send a request back to your server to indicate the message was received. However this will only work while the user is running your app.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
In general though, it sounds like you'e relying on push notifications for something you shouldn't. From Apple's Local and Push Notification Programming Guide:
Important Because delivery is not guaranteed, you should not depend on
the remote-notifications facility for delivering critical data to an
application via the payload. And never include sensitive data in the
payload. You should use it only to notify the user that new data is
available.
There is no way to find out whether the notification was delivered to the device or no. APNS is a one way service. If there is no internet connection on the device then the APNS server will hold the last notification for some period of time which is no specified by Apple. If a new notification is sent to APNS for delivery then the old notification data is lost and replaced by the new data if its undelivered. If the notification is delivered then also the old notification data is deleted on the APNS server.
Please go through the following link : Apple Push Notification
Hope this helps you...........
If you are using JAVAPNS to send the APNS notification, you can use the below:
List<PushedNotification> notifications =
Push.combined("alert", badge, "default", "cert.p12", "certpassword", true, deviceToken);
for (PushedNotification notification : notifications) {
if (notification.isSuccessful()) {
//Push is successful. Do your thing...
}
else {
//Push is not successful. Do your thing...
}
}

Push notifications to the same iPhone

I was successfully configured push notification and it sends notifications to other users well. However when I want to send a remote push notification to the same phone Im using it doesnt get any. However I know we can use local notifications but due to my requirement it has to be a push notification. Is there any blocking scenario where it doesnt allow the push to come to the same phone?
Thank you

How do you handle users who don't enable push notifications but might want to later on?

How do you handle users who initially disable push notifications? I keep a record of push id's using EASYAPNS and I'm concerned that if someone disables push notifications, they'll miss out on some great features of my app.
What do you do if they want to enable notifications later on? If I create a settings tab for push notifications and they later on enable them, will the app then and there generate a push id, or is it a one time thing and they're out of luck if they don't register for notifications the first time the app launches?
Thanks
According to Apple's Local and Push Notifications Programming Guide,
"an application should register every time it launches and give its provider the current token.
(...)
Users can thereafter modify the enabled notification types in the Notifications preference of the Settings application, and you can retrieve the currently enabled notification types by calling the enabledRemoteNotificationTypes method."
The user can always go to the iPhone Settings and enable or disable notifications for your app, doesn't matter if he initially had it enabled or not.
You don't need to write the code for setting of Push Notification. iPhone itself has a feature to enable or disable Push Notifications, but application must have implemented the code ofr Push Notification.