我的应用必须能够 to play alarm sound no matter what receiving push notification .
有没有办法配置音频会话播放声音:
-
和 NOT obey silent switch (路线可能会受到尊重)
-
upon arrival of push message (可以是沉默的)如果应用程序在后台或 even if killed by the iOS 同时?
-
即使用户使用任何其他音频应用程序(无条件混音),也会播放声音 .
我不需要将此应用程序发布到AppStore(仅供我私人使用),所以 private API is an option .
对于那些可能会提议 UILocalNotification
的人:那些不适合我的情况,因为他们必须遵守无声/环切换 .
1 回答
如果您不想使用UILocalNotification,则可以使用此处描述的选项:
http://oleb.net/blog/2014/02/alarm-clock-apps-ios/
简而言之,如果您选择退出iOS的多任务处理,并在运行应用程序时锁定手机,则可以继续运行自定义代码:
但是,如果这不适合您的用例,您可以使用
UIBackgroundModes
和remote-notification
在收到推送通知时唤醒您的应用,但是您不确定是否可以开始播放声音时使用'd have to have your own server infrastructure to keep track of your alarms. Even then, I'你的应用程序在后台......