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.
Related
I am new to iPhone Development.
i am trying to develop an Alarm application. I want to give a choice to the user to choose alarm ringtone from library like UIImagePickerController.
Is this possible ?
No, this is not possible, the UIImagePickerController is for image only and there is not such controller for picker the ringtone.
Also if you are scheduling alarms via UILocalNotification the the soundName property must contain a name of a sound file which is in you apps bundle.
For this property, specify the filename (including extension) of a sound resource in the application’s main bundle or UILocalNotificationDefaultSoundName to request the default system sound. When the system displays an alert for a local notification or badges an application icon, it plays this sound. The default value is nil (no sound). Sounds that last longer than 30 seconds are not supported. If you specify a file with a sound that plays over 30 seconds, the default sound is played instead.
I am working on an app that used UILocalNotification. I wanted to select sound from default sounds that came with iPhone. How can i list down sounds for assign as the alert tone.
There is one standard sound for notification from system (UILocalNotificationDefaultSoundName). You can play any custom sound shorter than 30 seconds. So, if you can download any native sound from ios from anywhere, you will be able to use it as custom sound. Documentation
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....
Is there a way to play UILocalNotification sound loudly ignoring the volume settings? Like this happen in "Find my iPhone" app. I found some answers on this question but all they according to charge and play AVAudioPlayer - which is not correct. We are not able to get the event of UILocalNotification appearing and try to play the sound from another source like AVAudioPlayer. We got the event in AppDelegate when user press "OK" button. So is ther a way to play loud sound by UILocalNotification itself?
No. If your app is running in the foreground, you can use application:didReceiveLocalNotification: and programatically play a sound. Otherwise, you're limited to the options in the UILocalNotification API, which is limited to a very specific set of options and does not let you set the sound volume.
How can I set that device should vibrate if a push notification come to my application?
I just figured out one way to do this: if you want to phone to only vibrate on receipt of a push notification, you need to have a silent sound file in your application bundle, for example "silence.aif" ... if you specify that sound file in the APS notification, the iOS device will "play" the silence.aif from your application bundle, but since the sound is silence, there is nothing to hear. However the notification vibration is still triggered :-)
I don't think it is possible to instruct the notification to vibrate. If you set a sound using soundName the notification will vibrate if the iPhone has Vibrate set to ON in Settings > Sounds, i.e. it depends on the settings of the individual iPhone.
Setting sound : "default" makes it vibrate for me. Even when phone is not on silent, it plays no sound and only vibrates.
You just need call this line:
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
Omitting the sound key should do the trick:
{"aps":{"alert":{"loc-key":"SOME_KEY"}, "badge":1}
The docs state that "If the sound file doesn’t exist or default is specified as the value, the default alert sound is played.". What they don't say is that if you don't provide a sound key at all, no sound will be played. If no sound is played, the phone should not vibrate as well.
if the iPhone has Vibrate set to ON in Settings > Sounds,and remove "sound="silence.caf",the end will be: doesn't vibrate