iphone - iOS : Programmatically control the volume of Notification alert and sound theme -
i have requirement like, through app want set notification sound , volume. because of our requirement. there 3 different states - happy, sad , normal. when user gain points send congratulation message, when lost points send message also. promotion related other message too. these state want set different notification sound , volume too. appreciate inputs. ty
for local notification
func schedulenotifications(inseconds: timeinterval, completion: @escaping (_ success: bool) ->()){ ... notif.sound = unnotificationsound.init(named: "customsound.mp3") ... }
for push notification
aps data should have sound key in , server need send file name should play,
{ aps = { alert = "message"; sound = "sound file name.extension"; badge = 1; }; }
Comments
Post a Comment