Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

local notification sound is not working

In iPhone app,

I am setting the local notification.

I am setting custom sound.

I could not 'hear' any sound when notification comes. Not even default sound.

Neither in my iPod touch nor in my device.

Any body can help me to find out the reasons ?

Thanks very much.

here is code.

UILocalNotification *localNotification = [[UILocalNotification alloc] init];

localNotification.fireDate=[dateFormat dateFromString:alarm_date];

localNotification.alertBody = @"Alarm.";

localNotification.soundName = [filePath lastPathComponent];

//localNotification.soundName =soundname; 
//UILocalNotificationDefaultSoundName;

localNotification.applicationIconBadgeNumber = 1;

localNotification.alertAction=@"Show";


[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];

[localNotification release];

Answer Got the Silly Point : Notification sound all only play when your app is in the background or closed. Sorry for this question. Any way thanks.

like image 981
Arpit B Parekh Avatar asked Oct 07 '22 19:10

Arpit B Parekh


1 Answers

the sound should be less than 30 seconds to be played as a notification sound

other thing:

According to the Apple Developer Documentation, you need to use "aiff", "caf" or "wav" files.

like image 158
Mutawe Avatar answered Oct 10 '22 03:10

Mutawe