Ios Swift : Add Message Tone and Vibration when notification received -


using ios 9 , swift 2

i have written function call notification when needed.

how add msg tone , vibration when notification received :

func getnotification(message:string) {     let curentseting = uiapplication.sharedapplication().currentusernotificationsettings()      if(curentseting!.types == .none)     {         let newseting = uiusernotificationsettings(fortypes: [.alert, .badge, .sound], categories: nil)         uiapplication.sharedapplication().registerusernotificationsettings(newseting)     }      let nfnvar = uilocalnotification()     nfnvar.firedate = nsdate(timeintervalsincenow: 0)     nfnvar.alertbody = message     nfnvar.soundname = uilocalnotificationdefaultsoundname     nfnvar.userinfo = ["namkey":"namvey"]     uiapplication.sharedapplication().schedulelocalnotification(nfnvar) } 


Comments

Popular posts from this blog

ios - Is 'init' forbidden as *part* of a variable name? -

javascript - Why Selenium can't find an element that is graphically visible -

qt - Microsoft FTP Service 451 The parameter is incorrect -