local notification style coming up as banner, instead of alert - ios

so i'm working on my first app. i'm trying to make an alarm that does OTHER STUFF. from what i've found, I want UIlocalnotification. So I've followed a few tutorials on the subject, and I have the notification fire. However, it shows as a banner which quickly disappears. I want it to look like the alarm clock alert... or any customer alert with OK, CANCEL.
Upon further reading in this forum, someone else asked the question, and if I'm reading it correctly only the USER can specify how the alert style looks.
Is this right? Can I not FORCE an alert box to popup at a specified time?
And what about UIAlertView... that looks like what I'm looking for also... can that be used to go off like an alarm clock and x time in the future?
appreciate the input, thanks

No, you cannot do that. The user is the one who decides what kind of notification he/she gets.

Related

Swift iOS system notification dismiss calback

Question:
Is there a way to detect if you get a system notification and you swipe away the notification banner (e.g. the alarm that triggers a system notification)?
More practical example:
In your app, you are doing some stuff and suddenly you get a notification from another app. Instead of tapping on the notification, you swipe up the notification (you dismiss it that way). After doing that, I want to capture that in the app.
Why:
Currently, I have a bug in the app, so if I can capture this action, I would be able to fix this bug.
Thanks in advance!
When notification appears, the willResignActiveNotification won't get called, therefore willEnterForegroundNotification won't get called, too.
The best solution here is to catch incoming notification and show the custom view describing this notification instead of system one. Thus, you can detect all actions/timings you need.

Create Lock Screen Notification Like Apple's Alarm App?

currently when my application is on lock screen, I just have a basic UILocalNotification pop up that opens the app when pressed and so on. However, I'd really like to make that better looking and I was wondering how Apple's Alarm Application has it's own unique notification on the lock screen? Does this also deal with manipulating notifications? Please, any help would be greatly appreciated...I've been searching for weeks :( alarm app lock screen example
So for now it is not possible to create a custom type notification like Apple Alarm Clock. There is no trace of it in UIKit framework docs. All we have is basic UIAlertController and UILocalNotification classes.

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.

UILocalNotifcation custom fire event, or struggle on with NSTimer

I have a state-transition problem with NSTimer, of which I find difficult to keep track of during applicationWillResignActive / applicationDidEnterBackground, according to the context of my app.
I was wondering if it might not be a better idea to utilise UILocalNotification, especially given it's background/inactive firing. However, I wanted to know whether we have the ability to provide a custom method to UILocalNotification, of which does not present a dialog box (would damage the whole point of my app). In effect, i'd like to only make use of the timer-fire capabilities of UILocalNotification, and handle the fire event with my own method which does something very "undialog-friendly"
Have checked the ADC docs and it alludes to the dialog being presented every time.
Any advice you can give on this would be appreciated.
thanks
sc.
The dialog box is presented when your app is in the background. But it is not presented when your app is running - instead your app is free to deal with the notification however it sees fit. So it would be perfectly possible to hook it up to a custom method of your own making.
The main reason for this behaviour is a user may not want to go into your app if it's in the background. Of course, with iOS 5 the notification may not be a dialog box - it could be one of the new notification styles.

User's chosen alert style for an iOS app

How can I know the alert style of my App, as set in the app's notification settings? That is, whether the alert style is "none" or "banners" or "alerts"? I guess there should be a property to know about it in notification center. But I did not find any.
I want to adjust the number of notifications that I post based on the style -- I believe that too many alerts will interrupt the user.
Thats not possible. If you want to access this information, file a bug report about it.

Resources