IOS local notification custom 30 seconds sound got cut off when on screen banner went up(app in foreground) I am using voip push notification - ios

Does anyone know is it possible to keep playing the custom notification sound after notification banner went up (app in foreground, in background it works perfectly full 30 seconds).

Related

iOS 10 Local Notifications dismissing early when screen is unlocked

I recently switched over to using PushKit and implementing local notifications so that I could do stuff like make the phone ring while another user is "calling" and have the notification dismiss as soon as the caller hangs up.
I am doing this by using pushkit and when the caller calls, a pushkit push is sent and a local notification that has a sound (repeating) for 28 seconds plays so that the notification stays up the whole time while the sound plays (at least in older iOS versions). And when the caller hangs up, another pushkit push is sent, and the previous local notification is canceled and another "missed call" one pops up. If the caller doesn't hang up, the call times out after 20 seconds and the "missed call" notification is sent then.
So my problem is that in iOS 10, if the screen is unlocked, the "ringing" notification goes away after about 6-7 seconds regardless of what the caller does. Then when the caller hangs up, the "call missed" notification displays.
On iOS 9 and iOS 8, the notification stays on the users screen until the user hangs up or the call times out.
Is there something special you have to do in iOS 10 to make the local notification stay on screen longer than 6-7 seconds if the screen is unlocked?

change remote notification time on screen

I have in my app a video chat.
And for the incoming call i'm using remote push notifications.
Is there a way to leave the notification on screen for a longer time then the default?
I need it to be on screen for about 20 seconds.
Thanks

How to play background push notification sound

I'm working on an app in which, upon receiving a push notification while in the background, should play a continuous sound until the app is opened.
Also, if the app is opened by clicking on the app icon, it should load push data.
How can I do this?

How to stop the LocalNotificationSound when application is opening from Device Locking screen

In my application iam using UILocalNotifications, and for that notification iam setting 30 sec audio file.
Notification fired if device is UnLock state and my app is in background mode then if i click on notification bar then my app is open and notification sound is stopping. This scanario is fine.
Notification fired if device is locke state and my app is in background mode then if i drag the notification then my app is open and notification sound is not stopping. In this scanario notification sound is continuesly playing upto 30 sec.
I need to stop the notification sound when app is open.
Please help me for implementing this functionality.
Thanks in advance.
You can't, since the sound is played by iOS and not your app. Thus you have no control over it.

Invoke the application to play a music on receiving a push in iOS

I implemented Push notifications in iOS. I want my application to play a music (about 15sec) when I send a push message. I am currently getting the push message, and the music is being played only if the app is in the foreground.
If the app is in the background, it shows up a notification, and when i tap it, it then plays the music.
But how do I get the functionality of automatically playing the music? I think this can be done because, in iOS, Audio apps can run in the background. So I just want the music to be played when the app goes to background, and it receives a push.
Can anyone help me with this please?
Thanks,
Nithin
Yes, there are two ways to do this.
The traditional way before iOS 7 is to register for audio playing background mode and play a silent sound forever, this will keep your app running in the background for a long time until the user kills it, or it is killed due to low memory.
This way has many drawbacks, the user must launch your app once so that you can start playing the sound and every time the iPhone is shut off, the user need to relaunch your app when he turn on the iPhone.
Also this will consume a lot of battery. 20%-30% a day for an iPhone 5.
The new way after iOS 7.0 is to exploit background fetch and remote notification, you can play your sound while performing a background fetch, which has a 30 seconds running time. Also you can trigger a background fetch with a push notification.
This is an article about background fetch and push notification http://www.objc.io/issue-5/multitasking.html

Resources