Tuyen Nguyen
Tuyen Nguyen

Reputation: 4479

Create UILocalNotification with sound and no vibration

Is it possible to create UILocalNotification playing a custom sound but not vibrate the phone?

EDIT: this is the code I used to create UILocalNotification, it works but it vibrates the phone. I don't want the phone to vibrate but I want to play a sound.

UILocalNotification *notif = [[UILocalNotification alloc] init];
notif.fireDate = [NSDate dateWithTimeIntervalSinceNow:seconds];
notif.timeZone = [NSTimeZone defaultTimeZone];
//notif.alertBody = alertMessage;
//notif.alertAction = @"Show me";
notif.soundName = soundName;
notif.applicationIconBadgeNumber = 0;
NSDictionary *userDict = [NSDictionary dictionaryWithObject:soundName forKey:kCurrentSound];
notif.userInfo = userDict;
[[UIApplication sharedApplication] scheduleLocalNotification:notif];
[notif release];

Upvotes: 2

Views: 1942

Answers (1)

shabbirv
shabbirv

Reputation: 9098

Unfortunately, if you want a sound, you can't disable vibration unless the user has went into the General Settings and disabled vibration themselves.

Upvotes: 1

Related Questions