How to handle logout event using push notifications? - objective-c

I have an app where I want to unregister for push notifications when the user logout. This can simply be done using
[[UIApplication sharedApplication] unregisterForRemoteNotifications];
However, is there no way to register (or prompt for registration) once a user login at a later time?
Answers to this question suggest there is not, so what is then the recommended way of handling this?
The documentation of notification services gives, as far as I can tell, no clue how to handle this.
All suggestions are appreciated!

You cannot re register for push notification programmatically. You must have to manage this by server side. See the answer
Enable or Disable Iphone Push Notifications inside the app

Related

selecting react native push notification

I am using react native and trying to add push notification.
My application need push notification because of chatting. I just need push notification to appear whenever the user receives chat message.
I've searched couple of libraries about push notification and found out firebase and react-native-push-notification.
Which one is proper library for this case and please tell me if there is other better way to solve this problem.
We're using invertase firebase notification library which is working so far better without any issues.
You'll get almost all the options which you needed for push notification customization like badges, etc.

Make app not open on push notification clicking

I am developing an app which enables pushNotification.When the app in inactive mode it receives push notification.When user click push notification app is opening.I do not want to open the app on push notification clicking.Is it possible do so?thanks in advance
There is no way to do this. Why do you want to do it anyway? You should probably use sound notification instead of banner/alert if you don't want user interaction.

RemoteNotification TOKEN not received if push notifications are not allowed

Really confused with this one!
I have an Adobe AIR iOS app and I am using the RemoteNotifier to subscribe for PushNotifications. More details http://www.adobe.com/devnet/air/articles/ios-push-notifications.html
I have the following listeners.
remoteNotifier.addEventListener(RemoteNotificationEvent.TOKEN, onToken);
After I reset my iPod to factory settings and reinstall my app (using the adhoc distribution), I click "Don't allow" for the pushnotifications when I get prompted.
I find that I then don't receive any RemoteNotificationEvent.TOKEN, so my app basically hangs waiting for that.
If I go to my Settings, Notifications and have a play with
Toggle Alert Style from the None to Alerts AND
Then back to None again (as it was)
I find that I can go back and launch my app with not problems. It's just that on the very first time user flow, I don't seem to get any TOKEN back.
Any ideas? Has anybody else seen this behaviour?
Or knows how I should handle this?
Thanks!
Hopefully I am correct, someone please correct me if I'm wrong.
From what I am able to find out, you won't get a RemoteNotificationEvent.TOKEN when the user clicks on "Don't Allow".
For some reasons that I am still unclear about, how after you play with the Settings and relaunch the app, you get the RemoteNotificationEvent.TOKEN, regardless of the notification settings you have set. But maybe that's the way it's meant to be?
So, really I have to change the flow such that I don't wait on that RemoteNotificationEvent.TOKEN before loading my first screen. If the TOKEN comes back, it comes back, otherwise if it doesn't, it's not a big deal as that means the user clicked on "Don't allow" and we don't need to send PUSH notifications anyway.
Everytime I relaunch my app, I do make the call to subscribe and get the TOKEN though, such that if the user was to enable the Notifications in the phone's Settings, I do have a TOKEN ID to send the push notification too.
The only problem I see with this though, is that should the user change the Notification to ON via the phone Settings and doesn't relaunch the app (to retrieve the TOKEN) then the device doesn't get push notifications.
Not sure how to handle this?

Simulate Push Notification (IOS5) without apn

I want to simulate push notification without using apn.
I have tried to HOOK SBSystemLocalNotificationAlert
and use
[objc_getClass("SBSystemLocalNotificationAlert") presentWithLocalNotification:notification application:bundle];
but it is just an alertview not like ios5 notification center, and it looks like ios4's push.
I want to simulate push notification (IOS5) for my daemon like MobileSMS.
sorry for my english
If you want to simulate push notifications without APN service, you can try this library: https://github.com/acoomans/SimulatorRemoteNotifications
Works in the simulator too.
That's a tough issue. I do not know whether it is possible (correct me guys if I am wrong).
However if you only need this for testing, you can use Parse.com for sending push notifications. Their basic service that includes push notification is for free and they deliver a working example code how to integrate.

iOS 5: Can I have my app "In Notification Center" by default?

I have an iPad app in the App Store whose logic relies largely on local notifications. In other words, much that happens inside the app is triggered by the delegate method application didReceiveLocalNotification.
With today's release of iOS 5, I see that apps can be placed (via Settings) either "In Notification Center" or "Not In Notification Center." I haven't found anything in the new documentation so far, but I'm hoping there is a way to have my app "In Notification Center" by default, (and possibly even set Sounds active and the notification type to Alert) which would save me having to explicitly explain to new users that after they download & install my app, they will have to manually go and elect for the app to be "In Notification Center."
Anyone know if this is possible? Seems that since an app can register a local notification, it should be able to receive it, by default (whether it displays an alert or an item in the new Notification Center, or not). Thanks in advance.
I've encountered the same problem. The only clue I saw in documentation is that the new Notification Center handles both local and remote notifications. Therefor I assumed that the app should register for local as it would for remote notification. Added this piece of code -
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
and after my app scheduled a local notification it appeared at the "In Notification Center".
BUT it seems to have no affect if my app already appears in "Not In Notification Center".. So have all of my customers that ran the app before the next update got screwed?
Currently it seems not.
I'm in a similar situation. I'd love to be wrong about this but I've found no mention of any such API (for specifying that a local-notification using app should appear in notification center by default) in any of the places I'd expect it to be:
Local and Push Notification guide
UIApplication class reference
UIKit Info PList keys
UIApplicationDelegate Protocol reference