-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Push received only in background #156
Comments
I added the forceMainActivityReload(false) after log "Don't Want Main Activity" on PushHandlerActivity.kt and app opens even when it is closed when I click on notification. |
I've done what you say and it still doesn't work. The push only comes when the app is closed or in the background. If I click on the push it opens the app or brings it to the front but does not execute the push.on ('notification', function (data) {... What do you use to send the push notification or data? If I use notification in the payload the push arrives but with data it does not arrive. This is my payload:
Thanks. |
I got it with Android 9.0.0 (& Android Studio 4.1.2 ) and phonegap-plugin-push, with Android 10.x.x still do not work. |
I have to move PushNotification.init on "setTimeout(()=>{},2500)". If push payload has "icon", the icon image must be in "res" of app, or app crashes when the notification arrives. When app crashes because of notification icon, the notification doesn't show and you think that it has not arrived. I have to figure out this in logcat to see the exception message. |
I can confirm this works for me as well (tested on Android 9 and 11). |
Bug Report
Error on Android
When the app is in front, the push is not received and the push.on ('notification' ... is not executed.
The push is recived in background and when de app is closed.
If I tap on push the app came on front but not do anything.
When I send the push with
$fields = array(
'registration_ids' => $registatoin_ids,
'data' => $data
);
The push does not arrive, but i i change:
$fields = array(
'registration_ids' => $registatoin_ids,
'notification' => $data
);
The push arrive but not in front.
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
Cordova Packages:
Project Installed Platforms:
Project Installed Plugins:
Environment:
Sample Push Data Payload
Tested with this plugin and with phonegap-plugin-push and the same error
The text was updated successfully, but these errors were encountered: