phonegap / phonegap-plugin-push

Register and receive push notifications
MIT License
1.94k stars 1.91k forks source link

Push Notification doesn't show up/slide down #2355

Open angjelkom opened 6 years ago

angjelkom commented 6 years ago

Expected Behaviour

Notification box should show up/ slide down when notification arrives

Actual Behaviour

Only an app icon is shown in the status bar that a notification arrived, but no notification box showed

Reproduce Scenario (including but not limited to)

Send a simple push notification to android

Steps to Reproduce

Send a simple push notification to android

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

Android 6.0.1 and Android 8.0

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

Samsung Galaxy S5, Xiaomi A1

Cordova CLI version and cordova platform version

cordova --version                                   8.0.0
cordova platform version android          7.1.0

Plugin version

cordova plugin version | grep phonegap-plugin-push   2.2.2

Sample Push Data Payload

{ message: "Hello World" additionalData: { notId: "4556" } }

angjelkom commented 6 years ago

@macdonst any help?

macdonst commented 6 years ago

@echonox do you mean when the app is in the foreground?

angjelkom commented 6 years ago

@macdonst no, both when in background and in foreground

macdonst commented 6 years ago

@echonox can you re-test using a title and message in the payload like this:

{
    "registration_ids": ["my device id"],
    "data": {
        "title": "Big Picture",
        "message": "This is my big picture message",
        "notId": "4556"
    }
}
angjelkom commented 6 years ago

@macdonst tried still not working

macdonst commented 6 years ago

@echonox I need more details like logs and the actual payload you send to the device and maybe how you send the push message?

angjelkom commented 6 years ago

@macdonst
here is the push data: {"registration_id":"1Y0yimllqEM:APA91bHvlLPj3rXh8u-9f7cDipniJvz_4BYFPa-dkCU8gL4W1WkUaAsfPHTwKpiWV_W718TDufnNSVEdQ7JJTnTOHzdmbcIOMMLmHh7kkhyqTSEXON-IgIy-Rcj_1OZJS8hdKVMtABdb","collapse_key":1,"data.message":"This is a test message","force-start":1,"notId":8849,"messageId":"some-id-here"}

here is the logcat:

05-09 10:32:07.214 7381 9011 D Push_FCMService: onMessage - from: 123456789012 05-09 10:32:07.214 7381 9011 D Push_FCMService: sender id = 123456789012 05-09 10:32:07.214 7381 9011 D Push_FCMService: normalize extras 05-09 10:32:07.214 7381 9011 D Push_FCMService: key = force-start 05-09 10:32:07.224 7381 9011 D Push_FCMService: replace key force-start with force-start 05-09 10:32:07.224 7381 9011 D Push_FCMService: key = messageId 05-09 10:32:07.224 7381 9011 D Push_FCMService: replace key messageId with messageId 05-09 10:32:07.244 7381 9011 D Push_FCMService: key = notId 05-09 10:32:07.244 7381 9011 D Push_FCMService: replace key notId with notId 05-09 10:32:07.244 7381 9011 D Push_FCMService: key = message 05-09 10:32:07.244 7381 9011 D Push_FCMService: replace key message with message 05-09 10:32:07.244 7381 9011 D Push_FCMService: no locale found for key = message, error Value This of type java.lang.String cannot be converted to JSONObject 05-09 10:32:07.244 7381 9011 D Push_FCMService: background 05-09 10:32:07.244 7381 9011 D Push_FCMService: message =[This is a test message] 05-09 10:32:07.244 7381 9011 D Push_FCMService: title =[null] 05-09 10:32:07.244 7381 9011 D Push_FCMService: contentAvailable =[null] 05-09 10:32:07.244 7381 9011 D Push_FCMService: forceStart =[1] 05-09 10:32:07.244 7381 9011 D Push_FCMService: create notification 05-09 10:32:07.264 7381 9011 D Push_FCMService: stored icon=null 05-09 10:32:07.264 7381 9011 D Push_FCMService: stored iconColor=null 05-09 10:32:07.264 7381 9011 D Push_FCMService: stored sound=true 05-09 10:32:07.264 7381 9011 D Push_FCMService: stored vibrate=true 05-09 10:32:07.264 7381 9011 D Push_FCMService: no icon resource found - using application icon 05-09 10:32:07.264 7381 9011 D Push_FCMService: create actions: with in-line

angjelkom commented 6 years ago

@macdonst closing issue, fixed it by setting priority to HIGH

angjelkom commented 6 years ago

@macdonst I've reopened the issue because i can still repro on Oreo Android 8.1, model is the Xiaomi A1 i mentioned

macdonst commented 6 years ago

@echonox logs from the Xiaomi A1 would help diagnose what is wrong.

angjelkom commented 6 years ago

@macdonst here the logs:

05-16 09:00:00.251 16194-16231/my.app D/Push_FCMService: onMessage - from: 12345678901 05-16 09:00:00.253 16194-16231/my.app D/Push_FCMService: sender id = 12345678901 normalize extras key = force-start replace key force-start with force-start key = messageId replace key messageId with messageId key = priority 05-16 09:00:00.254 16194-16231/my.app D/Push_FCMService: replace key priority with priority key = notId replace key notId with notId key = message replace key message with message no locale found for key = message, error Value This of type java.lang.String cannot be converted to JSONObject foreground force message =[This is a sample message] title =[null] contentAvailable =[null] forceStart =[1] create notification 05-16 09:00:00.259 16194-16231/my.app D/Push_FCMService: Using channel ID = PushPluginChannel 05-16 09:00:00.262 16194-16231/my.app D/Push_FCMService: stored icon=null stored iconColor=null stored sound=true stored vibrate=true no icon resource found - using application icon 05-16 09:00:00.266 16194-16231/my.app D/Push_FCMService: create actions: with in-line

macdonst commented 6 years ago

@echonox that all looks perfectly normal. Perhaps the Xiaomi phone has some setting to disable the notifications. I know some phones from Chinese manufacturers do this: https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#huawei-and-xiaomi-phones

angjelkom commented 6 years ago

@macdonst not possible, as the phone is Android Go Puree Stock

dkasipovic commented 5 years ago

+1 having the same issue on J7, only app icon is shown on the main status bar, and no slide-down whatsoever. Tried different payloads, to no avail.

@echonox Managed to resolve this?

angjelkom commented 5 years ago

@dkasipovic I've switched to cordova-plugin-firebase but that one has same issues, the problem I've found out is that Android Oreo has Notification Channel, and the plugins haven't implemented it properly so that it works, I don't have free time these days, but I plan to do a pull request on cordova-plugin-firebase and fix the issue.