Why will my notification sound alert not go off when go to the lock screen on my device and re-enter the app? - ios

I put in a notification into my app that works just right when I want it to go off. However I put a custom sound to that notification thats is about 30 seconds long. When I am at the HOME SCREEN of my device, when the the notification + sound goes off, I re-enter the app and the sound goes away. But when I am at the LOCK SCREEN, the notification goes off but when I re-enter the app it does not turn off. WHY

I guess, you can check the notification agent, whether the program allows notifications in the background.

Related

Force iOS notifications to show alert buttons without swipe or force touch

I have an iOS app which plays a long (20s) audio at some schedules. The problem is if alert style is set to BANNER ( Alert style in unlocked mode in iPhone settings) then audio plays for just about 5s and then the notification hides and audio playback terminates. How can I keep alert visible until end of audio playback?
Other people have same problem:
https://forums.developer.apple.com/message/185451#185451
Although one cannot force a banner notification to stay visible for more than 5 seconds, they can make a limited amount of actions persist in the background. For example, Whatsapp or Snapchat makes your phone keep on vibrating if you receive a call after the alert is gone. I do not know if sound can be made to persist after the banner alert disappears but I'm sure Apple Developer Support can direct you to where you need to go. There phone number is: 18006332152
Hope you find a well-trodded path! Good luck my friend.

iOS local notification - screen unlock

From my app I need to play a sound while generating a local notification (something like what happens when receiving a whatsapp call for example).
When the phone is locked, the local notification appears on the lock screen and the sound is played fine. During this, if the phone is unlocked by swiping on the notification icon, the app opens and things go on nice and smooth.
However, while the notification is on, if the phone is unlocked by not swiping on the app icon, but in the normal way (by swiping on the lower portion of the screen) the notification is lost. I do not see the notification back after the screen is unlocked, nor does the sound play any longer.
Can I have some clues to make the notification appear back after screen unlock and keep the sound playing?

UILocalNotification not firing properly on iPhone when app not foregrounded

UPDATE - a warning to anyone with similar symptoms... check Do Not Disturb is not active!
I finally paid to get an app I was working on running on my iPhone instead of on the simulator.
Having done so I've spotted a strange behaviour with regards to the UILocalNotifications that I create, which are set to use the default sound UILocalNotificationDefaultSoundName, and the default timezone ([NSTimeZone defaultTimeZone]).
If the app is foregrounded then the local notification fires on time and I receive it within
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
and I create an alert view to display it.
If however I lock my phone just before a notification is expected then nothing appears on the screen, but when I press the home button to show the lock screen I can see my app's notification in the notification centre on the lock screen. No sound was played, but then again the phone didn't wake up to show the notification properly.
If however I just press the home button so the app is put in the background leaving me looking at the springboard apps then I don't see any notifications whatsoever, and again no sound is heard.
On the simulator the same code correctly fires the notification banner when looking at the app icons in the spring board, although I've never been able to hear any sounds for the notification. But as the simulator doesn't let you configure the notification centre for apps I always presumed it was perhaps set to not allow sounds. On my device sounds for this apps notifications are enabled, and i've tried it with banner and alert modes, with no joy. Very frustrating.
Has anyone experienced this, or have an idea what could be going on?
Oh the irony of this answer.. think it's time to go to bed. My iPhone thinks that too for nearly 3 hours now... My question happily describes Do Not Disturbs behaviour, which was active.. Sorry to waste everyones time!!

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.

detect why iOS app went into background, hardware home or incoming push notification

I want my app to behave differently if the user pushes hardware home button, versus other reasons it may go into background. I think I have sorted out the main cases, except I can't tell the difference between user tapping on incoming push notification from another app and hitting the hardware home. In iOS 5, I was getting an applicationWillResignActive when the notify first appeared, and then applicationDidEnterBackground when the user tapped. In iOS 6, I cannot find any event triggered by the appearance of a banner notification from another app. The applicationWillResignActive and applicationDidEnterBackground come back to back, just as in hitting hardware home. I tried listening to UIWindowDidBecomeVisibleNotification and other UIWindow notification, but nothing is fired. Any ideas?

Resources