Reputation: 77631
I'm trying got send a "silent" push notification to the device that doesn't put anything onto the screen but it triggers reloading some info from the server.
I've stopped it displaying anything on the screen by not setting the alert
but the device still vibrates when the notification is received but only if the app is running.
Is it possible to stop the app from vibrating when the app is running and a notification is received?
Upvotes: 5
Views: 2171
Reputation: 301
It's happened to me. Maybe it'll help you. Check your code, one can make the phone vibrate invoking the AudioServicesPlaySystemSound method.
/**
* Remote Notification Received while application was open.
*/
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
#if !TARGET_IPHONE_SIMULATOR
NSString *sound = [apsInfo objectForKey:@“sound”];
NSLog(@“Received Push Sound: %@”, sound);
// Vibrate happen here!!
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
#endif
}
OR check your notification payload. Set your sound empty or just remove it.
{"aps":{"content-available":1, "sound":"", "badge":1}}
Upvotes: 0
Reputation: 1746
It's [PFPush handlePush:userInfo]
that's causing the device to vibrate.
If you are willing to forgo using [PFPush handlePush:userInfo]
and handle the push notifications using your own code, then there doesn't have to be a vibration.
Upvotes: 0
Reputation: 77631
If you remove the sound from the alert completely then no sound will play and if your app is closed then your phone won't vibrate.
However, if the app is open the phone will still vibrate.
No way to disable that unfortunately.
Upvotes: 1