play audio player when local notification generate - iphone

Good Morning to everyone. I am making an app for alarm clock in which i have used local notification for show alarm. But now problem is that when local notification generate on fire date then a default sound play. This sound file play for 2-3 seconds but i want to repeat that sound file while user not interact with local notification. I have made R&d On this topic but i get a same question here Question same
Here answer is u will generate multiple local notification. But when we generate multiple then user have interact so much notification and if user pressed close button of notification then we can not detect that event and other notification will generate while user not pressed view button of notification because we can detect by this function
-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification;
and we can cancel all notification here. So How i repeat sound of notification without create multiple local notification? Except local notification what i will use for make alarm clock which will work after app is not running?
Thanks in advances....

Related

Disable push notification sound whenever I want

Is there a way to disable the push notification sound - whenever the alert comes in.
Currently I am using a blank sound file to do this, but is there a way to disable the sound.
If you dont want to play sounds, you can register for remote notifications again for only alert notification type. If you want the sound should not be played on receiving the alert notification, you should not be sending the sound value in the notification payload sent from the notification server.
You specify a bitmask of notification types when you register for notifications. If you don't want a sound to be played when notifications come in, remove UIRemoteNotificationTypeSound from that bitmask:
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeBadge)];
Go to the preferences application and select "Notifications", select your app and turn off the sound.

Sound in Push Notification iPhone

Is there any way to set (toogle on/off) your push notification alert (after registered to APNS), sound and badge (by Code) inside an application?
I'm sorry the question seems a little ambiguous, actually I want to know
Is it possible to non activate the sound and alert inside the application function (by code) I am working. It is similar as you can disable the sound, alert or badge in iPhone Settings, But I want to do it in code.
It is like Whatsapp app in iPhone, there are some notification setting — we can toggle the alert on or off.
You could make a system where the user can choose a sound. Save that one. And in the method where the push notification comes in. Play that sound. I dont know if this works when the phone is on sleep mode.

UILocalNotification custom soundName only vibrates phone when alertBody is specified (unlike UILocalNotificationDefaultSoundName)?

I have a VoIP app that uses a UILocalNotification to notify the user of an incoming call when the app is in the background. When a notification is presented I would like it to play a sound & vibrate the phone -- more than once (and without presenting the same message repeatedly). I was able to do this by using a series of notifications - the first would immediately present the message and play a sound (the phone would vibrate as well) - following notifications were scheduled 3 seconds apart; they do not have an alertBody and alertAction but do have the same soundname as used in the first notification. HERE IS MY PROBLEM.. if a soundName other than the UILocalNotificationDefaultSoundName is specified the phone will only vibrate for the first notification (the sound will be played each time though). However, if the default soundName is used, then the phone will vibrate with each notification? Is there another way to do this?
Found another way.. display local notification and then start repeating the vibration via a timer.
Interesting. Sounds like a bug. File it with Apple and you might be able to get them to take care of it.

Differentiate if the app became inactive because the home button being pressed or an incomming phone call

I know that whenever the app becomes inactive, the UIApplicationWillResignActiveNotification local notification will be posted. In the opposite suituation, the UIApplicationDidBecomeActiveNotification notification will be posted.
A client want the app to act differently according to the interruption, he wants the app to close when the home button but to remain active if the user receives a phone call. It doesn't seem to be possible, I'm correct ?. If It's possible how can I do It ?
Edit: I know how to close my app whenever an interruption is received , my question is if it's possible to differentiate if the cause of the interruption was the home button being pressed or an incomming phone call, so my app responds differently in each case.
Using CTCallCenter notifications allows you to differentiate between incoming call or send-to-background using Home or multitasking tray reasonably reliably.
If you want the app to quit when the home button is pressed, you should set the UIApplicationExitsOnSuspend key to YES in the app's Info.plist file. If you edit the plist in Xcode, this key is displayed as Application does not run in background.
Then you can handle all of your termination in response to the UIApplicationWillTerminateNotification notification (or equivalently, in the appDelegate's applicationWillTerminate: method.
More information here: http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html

Handle interruptions from alerts during voice recording

I am working on a voice recording app wherein there could be interruption by phone calls, text messages, and/or system alerts. As for phone calls, I realize the recording has to be stopped and have worked this out successfully. My challenge seems to be with other alerts such as low-battery status, alarms, text messages, etc. For now, I have managed to pause and save recording as soon as an alert interrupt pops up, but am looking at more efficient options.
In most real-world scenarios on ad-hoc distribution mode, I notice that my users do not even monitor the iPhone or iPod screen when recording their voices. Also, in case we test this app on the iPod Touch, then the sounds for the alerts are pretty feeble and they miss out on the alerts and continue recording only to realize after a few minutes or maybe at the end of the session that the recording was interrupted.
Here are my questions:
Is it possible to continue recording voice in the background in the event of any system alerts or text message alerts popping up?
If not, would it be possible to make the app play a particular sound in the background that would continue to play until the user realizes something is wrong, looks into the screen, and if they dismiss the system alert then it would make the app come to the foreground and so stop the audio alert as the app has now gained focus, then can choose to continue recording from where they left off.
Any help would be greatly appreciated. Any other idea to handle this situation is most welcome.
You could try to implement application delegate methods
-(void)applicationWillResignActive:(UIApplication *)application{
[recorder playSound];
[recorder pause];
}
-(void)applicationDidBecomeActive:(UIApplication *)application{
[recorder record];
}
Put those methods in the appDelegate class.
If you want to implement your own alert do it in the applicationWIllResignActive, but I am not sure if you should do it, cause all the alerts like SMS, push notifications or battery warning trigger vibrations and sounds.