ios - iOS 推送通知的远程声音

标签 ios audio push-notification apple-push-notifications

我正在寻找在 iOS 设备上收到推送通知时播放自定义声音的方法。我知道在 iOS 上声音文件应该嵌入到应用程序包中。但我想要实现的是播放远程服务器上可用的声音。不幸的是,听起来我的应用程序的数据库太大了,无法将其全部捆绑到应用程序中。

我知道这不是那么简单,但我脑子里有一些想法:

  1. 播放类似 Endomondo 的声音,同时跟踪我们的锻炼情况。但我猜测它与定位 (GPS) 信号的一些后台任务有关。
  2. 像 Spotify 一样播放声音。设备收到通知后,只需通过流媒体播放音频播放器中的音乐即可。
  3. 将音乐文件下载到本地存储并像附加到应用程序包一样播放。但是是否有可能以这种方式(远程)更新应用程序包?

我的想法是否正确?或者完全确定在 iOS 上我们无法通过推送通知播放远程声音?

最佳答案

回答你的问题

  1. 不,不可能在远程通知上播放声音,除非你在主包上有它 check docs here

For remote notifications in iOS, you can specify a custom sound that iOS plays when it presents a local or remote notification for an application. The sound files must be in the main bundle of the client application.

  1. 即使您在主包中添加声音文件,该文件也不能超过 30 秒,因此 2 也是不可能的

Custom sounds must be under 30 seconds when played. If a custom sound is over that limit, the default system sound is played instead.

  1. 不,一旦应用发布,就不可能以任何方式更新主包,除非您发布更新

关于ios - iOS 推送通知的远程声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25877904/

相关文章:

python - 使用 GStreamer(或其他库)检测麦克风吹气

push-notification - 应用程序在后台时的 ngCordova/Ionic 推送通知

ios - 丢失分发的私钥,推送通知

ios - getInitialLink 上的 Firebase 动态链接仅在 IOS 和生产链接(React Native)上为空

iphone - 以编程方式调整控件大小后,AutoLayout 不工作 - iOS

ios - SpriteKit : create centred sprites in grid

audio - Tizen无法实时录制音频

ios - indexpath.row 从 1 而不是 0 开始

iphone - 音乐网站 : how to make it work on android/blackberry/iphone/symbian?

iphone - 在锁定的 android 或 ios 中收到后台通知时是否可以启动应用程序?