Firebase Cloud Messaging Notification Vibration

前端 未结 3 1549
迷失自我
迷失自我 2020-12-29 09:46

Is it possible to make an Android device vibrate when receiving notifications in the background with Firebase Cloud Messaging? From the Syntax Reference I have seen and test

3条回答
  •  灰色年华
    2020-12-29 10:06

    From what I have tested the format of the FCM Notification message seems to be quite rigid, so for customized notifications, the solution seems to be:

    1. Making sure that the payload of the JSON message being sent downstream contains the data parameter but doesn't contain the notification parameter (Sources: Message JSON Syntax, FCM Message Types)
    2. Creating the Notification in the implementation of the overridden onMessageReceived(RemoteMessage remoteMessage) from the application's FirebaseMessagingService (Example)

提交回复
热议问题