推送通知不振动且静音

编程入门 行业动态 更新时间:2024-10-24 14:19:46
本文介绍了推送通知不振动且静音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用 Parse 创建了推送通知,这些通知已成功发送到我的设备(真实世界,而不是模拟器).但是,这些推送通知是默默出现的,不会振动我的手机,也不会发出任何声音来通知用户.如果手机已锁定,并且手机处于开机状态,但未运行应用程序,则属于这种情况.

I have created push notifications using Parse which are successfully sent to my device (real-world, not a simulator). However, these push notifications appear silently, not vibrating my phone, nor making any sound to notify the user. This is the case if the phone is locked, and when the phone is on, but not running the app.

我在 didReceiveRemoteNotification: 方法中有代码来播放声音,在应用程序运行时播放.但是,当设备在应用未运行的情况下收到推送通知时,如何播放声音并使手机振动?

I have code in the didReceiveRemoteNotification: method to play a sound, which is played when the app is running. However, how can I play a sound, and get my phone to vibrate, when the device receives a push notification whilst the app is not running?

推荐答案

通过 NSDictionary 发送声音文件来修复,如 解析文档.

Fixed by sending the sounds file through an NSDictionary, as shown in the parse documention.

NSDictionary *data = @{ @"alert" : @"Jet fuel proven to melt steal beams!", @"badge" : @"Increment", @"sounds" : @"cheering.caf" }; PFPush *push = [[PFPush alloc] init]; [push setChannels:@[ @"Dank_Memes" ]]; [push setData:data]; [push sendPushInBackground];

更多推荐

推送通知不振动且静音

本文发布于:2023-11-27 10:12:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637651.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:静音   通知

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!