diff --git a/README.md b/README.md index 8642376a388eb7774c8531733c3f46524df45e38..c981527baf0be2a61c52c2bbc78a3bf1bcea743c 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 a6f6a6e8f1c47eeeb01563d03d217ed79a6d4b6d..303bfcfe21e4cc392f798abd8887aa00d4e804a9 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; }