我正在使用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