Quantcast
Channel: Developer Feed - Snippet
Viewing all articles
Browse latest Browse all 178

How to make iPhone vibrate on recieving Push Notification?

$
0
0

Snippet

When the push notification is received, the didReceiveRemoteNotification method of the App Delegate is called and one can make the phone vibrate invoking the AudioServicesPlaySystemSound method.

  1. /**
  2.  * Remote Notification Received while application was open.
  3.  */
  4. -(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
  5.        
  6.         #if !TARGET_IPHONE_SIMULATOR
  7.        
  8.         NSString *sound =[apsInfo objectForKey:@"sound"];
  9.         NSLog(@"Received Push Sound: %@", sound);
  10.         AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
  11.        
  12.        
  13.         #endif
  14. }

Viewing all articles
Browse latest Browse all 178

Trending Articles