ios - How to make a local notification alert with sound -
i want set sound in local notification when app in foregroundmode. m try lot of thing . please me.
uint32 flag = 0; systemsoundid soundid; int err = audioservicessetproperty(kaudioservicespropertyisuisound, sizeof(uint32), &uilocalnotificationdefaultsoundname, sizeof(uint32), &flag); nslog(@"%d",(unsigned int)err); audioservicesplaysystemsound(soundid);
if trying launch local notification sound can use soundname
property:
uilocalnotification *localnotif = [[uilocalnotification alloc] init]; localnotif.firedate = [nsdate datewithtimeintervalsincenow:30]; localnotif.alertbody = @"hey!"; localnotif.alerttitle = @"notification!"; localnotif.soundname = uilocalnotificationdefaultsoundname; [[uiapplication sharedapplication] schedulelocalnotification:localnotif];
with uilocalnotificationdefaultsoundname
notification use default sound, use filename instead custom sound.
more on property in documentation.
Comments
Post a Comment