From 4e2a19038a3ff0de5318f8aec14b3c29aa28cd4e Mon Sep 17 00:00:00 2001 From: Libin Lu Date: Wed, 31 Aug 2016 18:04:33 -0400 Subject: [PATCH] move flag out and read me --- README.md | 6 ++++++ .../main/java/com/evollu/react/fcm/FIRMessagingModule.java | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8642376..c981527 100644 --- a/README.md +++ b/README.md @@ -216,6 +216,7 @@ class App extends Component { ```json { "fcm": {"action": "fcm.ACTION.HELLO"}, + "opened_from_tray": 1, "extra": "juice" } ``` @@ -224,6 +225,7 @@ class App extends Component { ```json { "apns": {"action_category": "fcm.ACTION.HELLO"}, + "opened_from_tray": 1, "extra": "juice" } ``` @@ -252,6 +254,10 @@ Since Lollipop, the push notification icon is required to be all white, otherwis #### I am using Proguard You need to add this to your `android/app/proguard-rules.pro`: + +#### How do I tell if user clicks the notification banner? +- Check open from tray flag in notification. It will be either 0 or 1 for iOS and undefined or 1 for android. I decide for iOS base on [this](http://stackoverflow.com/questions/20569201/remote-notification-method-called-twice), and for android I set it if notification is triggered by intent change. + ``` # Google Play Services -keep class com.google.android.gms.** { *; } diff --git a/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java b/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java index a6f6a6e..303bfcf 100644 --- a/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java +++ b/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java @@ -129,8 +129,9 @@ public class FIRMessagingModule extends ReactContextBaseJavaModule implements Li } WritableMap fcm = Arguments.createMap(); fcm.putString("action", intent.getAction()); - fcm.putInt("opened_from_tray", 1); params.putMap("fcm", fcm); + + params.putInt("opened_from_tray", 1); return params; } -- 2.26.2