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

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -