I previously had an issue with sending data to my device (https://github.com/wix/react-native-notifications/issues/497). Solved this by changing the payload to (Amazon SNS):
{
"GCM":" {
\"notification\": {
\"title\": \"title\",
\"body\": \"Sample message for Android endpoints\"
},
}
But I still think I the docs can be more clear about how to implement a custom FirebaseMessagingService. Right now I want to send data to my app, I'm not sure if this works without a custom FirebaseMessagingService or how to implement one.
Although with the custom messages send via Amazon SNS are now shown on my Android device, the registerNotificationOpened event is not triggered when I click the notification (on iOS it is). How can I resolve this?
I want to open a certain screen when opening the notification based on data send with the notification.
Do I have to add the custom FirebaseMessagingService to my app to handle data? How can I implement this? Tried sending another payload as stated in the docs (https://firebase.google.com/docs/cloud-messaging/concept-options) with the apns key, but it didn't work out as expected. The registerNotificationOpened was not triggered and the data was not parsed in the same way as on iOS where everything works without any hassle.
Thanks for the help in advance.
On Android the registerNotificationOpened seems to be only triggered when a registerNotificationReceivedForeground is received. With registerNotificationReceivedBackground the callback isn't activated. Looks like the function registerNotificationReceivedBackground isn't called either.
Tested on Samsung S9 (Android 8.0.0) and Huawei P20 Lite (Android 9).
These issues seem to be the same, unfortunately no solution yet; https://github.com/wix/react-native-notifications/issues/482 & https://github.com/wix/react-native-notifications/issues/478 & https://github.com/wix/react-native-notifications/issues/445#issuecomment-576767257
Having the same issues! Does anybody have a fix for this ?
Exactly the same here.
Have the same problem (react-native-notifications: 3.1.1 and react-native: 0.61.5)
I have this problem when I use a service on AndroidManifest, probably related to this issue #497. I have tried a lot of version of this lib and none solved the problem.
<service
android:name="com.mixpanel.android.mpmetrics.MixpanelFCMMessagingService"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
react-native 0.60 and react-native-notifications: 3.1.2.
Unfortunately I wasn't able to fix the issue yet as well. Really hope to receive an update from the library maintainers soon.
Maybe this PR resolves the issue https://github.com/wix/react-native-notifications/pull/527/files
This issue still remains, any update guys ?
@rnnyrk what do you think about the PR of @ttkien
@rnnyrk are you able to find anything that works for android? I'm stuck too. I tried all the available libraries.
Just applied fix by @ttkien. Works for me. in DEV at least.
@juddey can i see your implementation, i have applied fix by @ttkien but not work.
@gibrandev Did you apply it in your node_modules directory with the latest version of RNN (ie 3.1.4)?
Heres the diff from patch-package
+++ b/node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/NotificationIntentAdapter.java
@@ -22,7 +22,9 @@ public class NotificationIntentAdapter {
public static boolean canHandleIntent(Intent intent) {
if (intent != null) {
Bundle notificationData = intent.getExtras();
- if (notificationData != null && intent.hasExtra(PUSH_NOTIFICATION_EXTRA_NAME)) {
+ if (notificationData != null &&
+ (intent.hasExtra(PUSH_NOTIFICATION_EXTRA_NAME) ||
+ notificationData.getString("google.message_id", null) != null)) {
return true;
}
}
Good luck!
@juddey I already did, but it still doesn't work
FYI: in my script, this event placed in App.js
Notifications.events().registerNotificationOpened
What is wrong?
Not sure. I had this:
Notifications.events().registerRemoteNotificationsRegistered(event => {
// TODO: Send the token to my server so it could send back push notifications...
console.log('Device Token Received from main.js', event.deviceToken)
})
then the function you posted, and it works.
```
@juddey everything I have done, still does not work.
Same Here
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
I am having the same issue.
One more here! 馃檭
same here
same issue. any update for this
I facing the issue on android device by steps:
For my own app I got this working! I managed to get registerNotificationOpened to trigger when I changed the AndroidManifest. I added the following:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.INFO" />
</intent-filter>
to:
<activity
android:name=".MainActivity"
android:label="@string/app_name">
</activity>
and it worked. Of course, in my app I also have:
<activity
android:name=".SplashActivity"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
No change in node_modules or anywhere else required
Hi @varun-batta-vc,
Currently, I can't reproduce that issue. sometimes the issue happened, sometimes it's not happened the issue can't reproduce totally.
https://stackoverflow.com/a/62445342/9377254
MODIFY MANIFEST LIKE THIS
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
<!-- Add this SplashActivity -->
<activity
android:name=".SplashActivity"
android:theme="@style/SplashTheme"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.INFO" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
hi, I have the same problem,
also, I get this warning when the app opens after clicking a notification :
no task registered for key ReactNativeFireBaseMessegingHeadlesstask.
any update?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
The issue has been closed for inactivity.
Most helpful comment
Maybe this PR resolves the issue https://github.com/wix/react-native-notifications/pull/527/files