1

这个问题可能看起来很奇怪,但请原谅。

是否可以发送带有推送消息的音频文件?这样每当设备收到推送消息时,就会自动播放音频文件!

我知道有效载荷只接受字符串,但只想知道其他可能性! 资源

到目前为止,我们尝试过这种方式,

推送消息被发送到设备。每当用户选择推送消息时,设备上都会播放警报(iPhone 或 Ipad 中的本地音频文件)。

4

1 回答 1

1

You can only send a filename of a sound file that is packaged with your application. That file will be played automatically when the notification arrives. Actually sending a sound file in the payload in not possible. Even if you encode the data somehow in a way that can be included in the json payload of the notification, you are limited to 256 bytes, and there isn't much you can send with that.

APN Guide :

sound

The name of a sound file in the application bundle. The sound in this file is played as an alert. If the sound file doesn’t exist or default is specified as the value, the default alert sound is played. The audio must be in one of the audio data formats that are compatible with system sounds; see “Preparing Custom Alert Sounds” for details.

于 2013-03-05T11:37:27.637 回答