I'm working on a VoIP phone for iOS, and if a call comes in while running in the background, I do a presentLocalNotificationNow with a UILocalNotification message to inform the user. This works fine, however the banner expires and rolls off the screen before the user has enough of a chance to swipe and answer. I have tried scheduling further notifications at regular intervals, but that fills up the notification centre and causes the banner to appear to be tumbling.
Is there some way to prevent the banner from disappearing until I cancel it in some manner? Both the Skype app and Bria VoIP app have managed to come up with a solution where the banner stays until the call is answered, or the callee hangs up.
The best way to do this is to add a sound to the local notification.
The default notification without a sound lasts 5 seconds as a banner, however you can include
a sound that is longer, up to 30 seconds that you can play when the local notification is posted. The banner notification will stay on screen as long as the sound is playing.
No. I think it is not possible to control/increment the hiding banner time to display. It is it's default behavior.
But instead of Banner style you can set Notification style as Alert. Which will not hide/disappear until user will click on alert's buttons.
Hope this will help.
Related
I’ve developed a Xcode app to trigger an action on timer expiry. This works fine when the app is visible on the device. However when the app is minimised eg. the Home button is pressed, the app doesn’t work. It seems like the app gets suspended. It resumes the countdown when it is brought to the foreground again.
Any guidance will be appreciated.
Timers will only run in the background if your app is running in the background for another reason. You will need to enable a background mode on the capabilities page. Your timer will also need to have already started when you enter the background
This may also be helpful:
https://www.raywenderlich.com/5817-background-modes-tutorial-getting-started
It seems as soon as I unlock my iPhone in the morning Groupon's notifications show up on the top of my notification tray. This can happen anywhere between 8-10am, so I was wondering how are they able to do this.
I have GuitarToolkit on my iPhone4S (iOS 5.01 - NOT jailbroken) It has a metronome feature which continues playing in the background, and also adds a red banner overlay (see screenshots) which persists on the home/lock screen and also when other apps are running. The banner is animating (background colour pulses) and it is also 'active' in that pressing it will return you to the GuitarToolkit app.
I know about the background audio APIs for the sound, but how does it do this banner? My first thought was local notifications, but nothing appears in notification center, and GuitarToolkit is not listed under Notifications in Settings.
My iPhone is not jailbroken and GuitarToolkit is available in the App Store, so what APIs is it using to achieve this?
Having an active AVAudioQueue creates that banner.
The banner appears because it’s got an open audio recording session—you’ll notice that the system Voice Memos app does the same thing, as does Shazam for a moment before it enters the background and Skype when you’re on a call with the app in the background. I’m not sure of the specific API, but that’s generally what’s going on.
I was watching videos of iOS 5 Push Notification and I encountered that there are some differences in notifying User apart from Badges, Alert and Sound.
Please go through the Youtube video. Here the notification of Twitter comes on the status bar. So do we need to have programming in different way than our usual push notification?
Also when we drag that view downwards than directly navigated to new Message. So how can we achieve those new changes as being a Developer?
One More question is How can we achieve the scrolling in Notification Window....
Do you mean the banner that sits over the status bar? That's an option your users can choose in Settings. Just push an alert as usual, and if your users have selected to display alerts as banners, that's what they'll see.
No changes need to be done at developer end for viewing notifications in Notification bar or Banner. Though I have no idea how to enable scrolling in Notification Window.
I see a very weird behavior and I am trying to understand if it is designed that way or simply not handled correctly from my app.
My app sends push notifications in the form of UIAlertViews.
When the device is not locked the UIAlertViews appear with two buttons and if the user taps on the right button my app is launched.
What I have noticed is that if the device is black screened to save power and the user taps on the home button and there is a push notification alert from my app with only the OK button waiting for him there, if he slides to unlock the device he automatically enters my app.
Is that a normal behavior or a bug of some sorts? I thought that only UIAlertViews with two buttons allow the user to launch the app.
If a push-notification-message gets sent to a locked phone, it stays there for about five minutes. When the user slides to unlock, the app that sent the notification is opened.
This is default behavior, look at how the SMS-app and Calendar-app does the same.
For me (OS 4.1), normal behaviour is for a push notification to unblank the screen and show an alert with no buttons; the slider says "slide to VERB". If the phone goes back to sleep and is woken again (either by waiting or by hitting the sleep switch), it then says "slide to unlock" and unlocking doesn't launch the app.
I don't see an "OK" button (perhaps it's an OS 4.2 feature; if so, don't discuss it here).
Either way, the user only has three choices:
Don't unlock the phone
Unlock the phone and ignore the notification
Unlock the phone and launch the app
Making the user unlock before choosing what to do about the notification adds an unnecessary step, and letting the user tap the VERB button without unlocking the phone is a bit silly. The common case is that the user will want to immediately view the notification (and reply to the text or whatever). The uncommon case is that the user will want to ignore the notification (so press OK and then unlock, or sleep/wake and then unlock, or unlock and immediately close the app). If the notifications are a nuisance, then the user will simply disable them for the particular app.