我正在使用com.google.firebase:firebase-messaging:10.0.1
进行Android和尝试使设备在应用程序处于后台并收到推送通知时进行振动。 我发送以下JSON来FCM服务器:Firebase推送通知在后台振动
to: 'topics/...',
notification: {
title: 'New Message',
body: 'top security body',
sound: 'mysound',
action_click: 'top_security'
}
当应用程序在前台,被触发的FirebaseMessagingService
的onMessageReceived
方法,我可以添加震动。但是,当应用程序在后台,onMessageReceived
不叫,我无法控制振动。我的第一个想法是使用data
块代替背景和前景,但如果没有notification
块,iOS客户端不会在后台接收到推送。
那么如何添加振动来推送通知,当应用程序在后台? P.S.当我在设备上打开振动模式时,推送通知会导致振动而不是播放声音。
,因为您需要发送无声通知,按照这个[链接](http://stackoverflow.com/questions/37570200/firebase-silent-apns-notification) –
请参阅我的回答在这个链接,http://stackoverflow.com/a/42505362/1404798 – Thirumalvalavan
@mahmoudmoustafa我正在使用android,看标签 – IlyaEremin