I am trying to customize a push notification alert. I copied one sound file to the application bundle and set the sound file name in the push notification payload to that of the new file name, But the sound is not playing. How can I change the push notification alert sound?
Try one aiff demo sound for push notification also make sure your device is not mute.
Related
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.
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 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.
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.
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