diff --git a/Examples/simple-fcm-client/app/FirebaseClient.js b/Examples/simple-fcm-client/app/FirebaseClient.js index 1eb3722fc071de2a760f9c161b18cb17c937dbcb..f537a4e68c12e25ac642a5a2ac55b195eae3cce2 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"); }