NewsStand, Show the push notification alert view when I want? - ios

I know this has been asked: How to show "Would like to send you Push Notifications" Alert View again? ... But My question is kind of different. My question is that is it possible to prompt this when ever I want programmatically (not for debugging but for real). Probably not because this is an alert triggered by the operating system, but is there a way to "undo" if a user clicked "don't allow". My app has a tutorial I want to pop this message when the user finishes the tutorial. Should I just register for push notifications after the tutorial?. Or what the user has to "allow" on the settings menu so I can add it to the tutorial. Thanks

To trigger popup you provide on image you should call
[[UIApplicaton sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeNewsstandContentAvailability]
This is possible to do in any place in app.
To check available permissions use:
UIRemoteNotificationType* enabledTypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];

Related

How to custom push notification notice?

How to custom push notification button for when presented with the option to select to "Allow" or "Don't allow" push notification? Is it possible?
Thanks.
You can't customise the alert displayed that asks the user whether to Allow push notifications or not.
What some apps do is show an alert or image explaining what the push notifications are for, and when you press allow it shows the system Allow/Don't Allow alert.

How to show push notification dialog based on conditions

I'm frustrated of finding the solution about this problem. I have been developing an application that will prompt an UIAlertView to the user at the first time it starts. I want that upon user choosing Agree, then the push notification dialog appears. But the problem is the push notification dialog appeared at the SAME TIME that UIAlertView was prompted to the user. How can I make the push notification dialog appears only after the Agree button of the UIAlertView was tapped?
"Use the shared instance of [UIApplication sharedApplication] to register for push notification in your view controller when the alert view is dismissed. Then, the push notification alert will appear after your alert view."
Thanks to insane-36

IOS push notification delete

I use a phone gap plugin and xcode 5.
Lets see the example of the problem:
The application is in background or closed.
I send the notification.
User sees the notification pop up, without clicking on it.
I send another notification.
If user open notification bar it will see two notification actually i want
to delete the previous some how and present to user only the second notification.
The eqvivalent in java is NotificationManage.cancelAll();
For now each/all notification i send are shown when user open notifications bar.
Any help appreciated.
You have (the app has) no control over that.
The user controls how many notifications they see in notification center. Notifications can be removed by the user and will be removed when acted upon (the app is opened from the notification).
You can do this by [UIApplication sharedApplication].applicationIconBadgeNumber = 0;
in the method didReceiveRemoteNotification. In this way notification center will be cleared.

Is it possible to change the display duration of a UILocalNotification?

I need to display a local notification and have it remain on screen longer than the default 4-5 seconds, preferably until the app itself removes it. I've seen other apps (e.g. Pandora) that manage to do this somehow (maybe a push notification?), but I can find no duration property on UILocalNotification or in UIApplication methods like presentLocalNotificationNow:, scheduleLocalNotification:, etc. Neither the documentation nor any of the tutorials I've found address the display time at all. Is this something that just can't be done with local notifications?
A couple of solutions here and I would not recommend either:
1- You can request from the user to go to settings > Notification Center > your app. And change the alert style from Banner (default) to Alerts. This will present the user an alert similar to the alert presented when the app is in the foreground. The user would have to dismiss the alert versus the banner style notification that just appears/disappears. Unless this is a corporate app and you have the users buy in, I would not go that route as this could annoy the user.
2- I tested the sound clip method and yes, if you present a notification with a clip < 30seconds; the notification will stay on the (top of the) screen until the sound clip is finished playing. Having said that, if the user taps any of the volume button (to reduce the sound for example), the notification is immediately dismissed even before its end! I think though that the purpose of the notification is a gentle reminder and, lasting more than the typical 4-5 seconds goes against the norm and, it might annoy the user (or the user might think something is stuck, phone froze, etc..). Here is the code anyway:
UILocalNotification *howLongCanANotificationLast = [[UILocalNotification alloc]init];
howLongCanANotificationLast.alertBody=#"I am a notification";
howLongCanANotificationLast.soundName=#"musicfilename.mp3";
[[UIApplication sharedApplication] presentLocalNotificationNow:howLongCanANotificationLast];
Hope this helps.

How to make UILocalNotification which doesn't launch my app

I am using UILocalNotification to let a user know something. However, it's for a note for him and it doesn't require any actions in my application.
I set:
localNotification setAlertAction:nil];
[localNotification setHasAction: NO];
So, it shows only in the top of Home screen. However, if the user clicks on it, my app got launched.
Is there a way to create a local notification, which won't launch my app, when it's tapped?
If the user clicks on a local notification alert, iOS will launch the associated app. This is the expected behaviour of handling local notification. I don't believe you can change it.

Resources