From 1ab567cf1064fd961ea07b7b6053af13f3de96f6 Mon Sep 17 00:00:00 2001 From: Libin Lu Date: Mon, 2 Oct 2017 10:40:35 -0400 Subject: [PATCH] update example --- .../simple-fcm-client/app/FirebaseClient.js | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/Examples/simple-fcm-client/app/FirebaseClient.js b/Examples/simple-fcm-client/app/FirebaseClient.js index 1eb3722..f537a4e 100644 --- a/Examples/simple-fcm-client/app/FirebaseClient.js +++ b/Examples/simple-fcm-client/app/FirebaseClient.js @@ -12,30 +12,33 @@ class FirebaseClient { } sendNotification(token) { - let body = { - "to": token, - "notification":{ - "title": "Simple FCM Client", - "body": "This is a notification with only NOTIFICATION.", - "sound": "default" - }, - "priority": 10 - } + let body; if(Platform.OS === 'android'){ body = { "to": token, - "data":{ - "custom_notification": { - "title": "Simple FCM Client", - "body": "This is a notification with only NOTIFICATION.", - "sound": "default", - "priority": "high" - } - }, - "priority": 10 + "data":{ + "custom_notification": { + "title": "Simple FCM Client", + "body": "This is a notification with only NOTIFICATION.", + "sound": "default", + "priority": "high", + "show_in_foreground": true + } + }, + "priority": 10 } - } + } else { + body = { + "to": token, + "notification":{ + "title": "Simple FCM Client", + "body": "This is a notification with only NOTIFICATION.", + "sound": "default" + }, + "priority": 10 + } + } this._send(JSON.stringify(body), "notification"); } -- 2.26.2