onnotification js callback не вызывается при нажатии на уведомление - PullRequest
1 голос
/ 03 апреля 2019

Занимаюсь сборкой андроид приложений с использованием Cordova.для push-уведомлений использую плагин FCM.Уведомление получено в области уведомлений успешно.При щелчке уведомления также открывается приложение.

Проблема связана с обратным вызовом onNotification, который никогда не возвращается.При просмотре журналов я могу обнаружить, что данные уведомлений хорошо анализируются приложением.Классы FCMPluginActivity и FCMPlugin вызываются.

Единственное исключение, которое я получаю в своем коде, - отключенный собственный мост.

Ниже приведено мое уведомление json.

{  
"to" : "c54F_ChDDFk:APA91bG2Vq-pvNDAQgeT_2MEJbb-7BaD2uB8tocBm8y4oFaNu1tBQiu8jIiXWXi4SAMkI_GY7v6iPB7VT8rpNjKJ53FspuHlTxRdWsSkabfPyG4A5lhK-qFgw2MjGT8FQd46m3vBCcpz",
   "notification":{  
      "title":"Notification title",
      "body":"Notification body",
      "sound":"default",
      "click_action":"FCM_PLUGIN_ACTIVITY"
   },
   "data":{  
      "param1":"value1",
      "param2":"value2"
   },
   "priority":"high",
   "restricted_package_name":""
}

amс использованием следующих плагинов.

cordova-plugin-battery-status 1.1.2 "Battery"
cordova-plugin-camera 2.1.1 "Camera"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-contacts 2.0.1 "Contacts"
cordova-plugin-device 1.1.7 "Device"
cordova-plugin-device-motion 1.2.5 "Device Motion"
cordova-plugin-device-orientation 1.0.7 "Device Orientation"
cordova-plugin-dialogs 1.2.1 "Notification"
cordova-plugin-fcm-with-dependecy-updated 2.4.0 "Cordova FCM Push Plugin"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-file-transfer 1.5.1 "File Transfer"
cordova-plugin-geolocation 2.1.0 "Geolocation"
cordova-plugin-globalization 1.0.9 "Globalization"
cordova-plugin-inappbrowser 1.3.0 "InAppBrowser"
cordova-plugin-media 2.2.0 "Media"
cordova-plugin-media-capture 1.2.0 "Capture"
cordova-plugin-nativestorage 2.3.2 "NativeStorage"
cordova-plugin-splashscreen 3.2.2 "Splashscreen"
cordova-plugin-statusbar 2.1.3 "StatusBar"
cordova-plugin-vibration 2.1.6 "Vibration"
cordova-plugin-whitelist 1.2.2 "Whitelist"
cordova-support-google-services 1.1.0 "cordova-support-google-services"
phonegap-plugin-multidex 1.0.0 "Multidex"

, приведенные ниже, представляют собой журналы консоли после нажатия уведомления.

2019-04-03 17:33:55.423 4170-4170/sa.tfe.oneteam V/FA: onActivityCreated
2019-04-03 17:33:55.423 4170-4170/sa.tfe.oneteam D/FCMPlugin: ==> FCMPluginActivity onCreate
2019-04-03 17:33:55.424 4170-4170/sa.tfe.oneteam D/FCMPlugin: ====Activity::::value from native storage=updatedValue
2019-04-03 17:33:55.426 4170-4170/sa.tfe.oneteam D/FCMPlugin: ====Activity::::updated value from native storage=updatedValue
2019-04-03 17:33:55.426 4170-4170/sa.tfe.oneteam D/FCMPlugin: ==> USER TAPPED NOTFICATION
2019-04-03 17:33:55.426 4170-4170/sa.tfe.oneteam D/FCMPlugin:   Key: google.delivered_priority Value: high
2019-04-03 17:33:55.427 4170-4170/sa.tfe.oneteam W/Bundle: Key google.sent_time expected String but value was a java.lang.Long.  The default value <null> was returned.
2019-04-03 17:33:55.428 4170-4170/sa.tfe.oneteam W/Bundle: Attempt to cast generated internal exception:
    java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String
        at android.os.BaseBundle.getString(BaseBundle.java:1089)
        at com.gae.scaffolder.plugin.FCMPluginActivity.onCreate(FCMPluginActivity.java:44)
        at android.app.Activity.performCreate(Activity.java:6984)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1235)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2783)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2909)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1606)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6592)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:769)
2019-04-03 17:33:55.428 4170-4170/sa.tfe.oneteam D/FCMPlugin:   Key: google.sent_time Value: null
2019-04-03 17:33:55.428 4170-31193/sa.tfe.oneteam V/FA: Using measurement service
2019-04-03 17:33:55.428 4170-4170/sa.tfe.oneteam W/Bundle: Key google.ttl expected String but value was a java.lang.Integer.  The default value <null> was returned.
2019-04-03 17:33:55.429 4170-31193/sa.tfe.oneteam V/FA: Connecting to remote service
2019-04-03 17:33:55.430 4170-4170/sa.tfe.oneteam W/Bundle: Attempt to cast generated internal exception:
    java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
        at android.os.BaseBundle.getString(BaseBundle.java:1089)
        at com.gae.scaffolder.plugin.FCMPluginActivity.onCreate(FCMPluginActivity.java:44)
        at android.app.Activity.performCreate(Activity.java:6984)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1235)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2783)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2909)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1606)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6592)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:769)
2019-04-03 17:33:55.430 4170-4170/sa.tfe.oneteam D/FCMPlugin:   Key: google.ttl Value: null
2019-04-03 17:33:55.430 4170-4170/sa.tfe.oneteam D/FCMPlugin:   Key: google.original_priority Value: high
2019-04-03 17:33:55.430 4170-4170/sa.tfe.oneteam D/FCMPlugin:   Key: param1 Value: value1
2019-04-03 17:33:55.430 4170-4170/sa.tfe.oneteam D/FCMPlugin:   Key: param2 Value: value2
2019-04-03 17:33:55.430 4170-4170/sa.tfe.oneteam D/FCMPlugin:   Key: from Value: 825633758297
2019-04-03 17:33:55.430 4170-4170/sa.tfe.oneteam D/FCMPlugin:   Key: google.message_id Value: 0:1554293018484380%dfdafb68dfdafb68
2019-04-03 17:33:55.431 4170-4170/sa.tfe.oneteam D/FCMPlugin:   Key: collapse_key Value: sa.tfe.oneteam
2019-04-03 17:33:55.431 4170-4170/sa.tfe.oneteam D/FCMPlugin: ==> FCMPlugin sendPushPayload
2019-04-03 17:33:55.431 4170-4170/sa.tfe.oneteam D/FCMPlugin:   notificationCallBackReady: true
2019-04-03 17:33:55.431 4170-4170/sa.tfe.oneteam D/FCMPlugin:   gWebView: org.apache.cordova.CordovaWebViewImpl@85c8a92
2019-04-03 17:33:55.431 4170-4170/sa.tfe.oneteam D/FCMPlugin:   payload: collapse_key => sa.tfe.oneteam
2019-04-03 17:33:55.431 4170-4170/sa.tfe.oneteam D/FCMPlugin:   payload: wasTapped => true
2019-04-03 17:33:55.431 4170-4170/sa.tfe.oneteam D/FCMPlugin:   payload: google.original_priority => high
2019-04-03 17:33:55.431 4170-4170/sa.tfe.oneteam D/FCMPlugin:   payload: google.sent_time => null
2019-04-03 17:33:55.431 4170-4170/sa.tfe.oneteam D/FCMPlugin:   payload: google.delivered_priority => high
2019-04-03 17:33:55.431 4170-4170/sa.tfe.oneteam D/FCMPlugin:   payload: google.ttl => null
2019-04-03 17:33:55.431 4170-4170/sa.tfe.oneteam D/FCMPlugin:   payload: from => 825633758297
2019-04-03 17:33:55.431 4170-4170/sa.tfe.oneteam D/FCMPlugin:   payload: google.message_id => 0:1554293018484380%dfdafb68dfdafb68
2019-04-03 17:33:55.431 4170-4170/sa.tfe.oneteam D/FCMPlugin:   payload: param1 => value1
2019-04-03 17:33:55.431 4170-4170/sa.tfe.oneteam D/FCMPlugin:   payload: param2 => value2
2019-04-03 17:33:55.432 4170-4170/sa.tfe.oneteam D/FCMPlugin:   Sent PUSH to view: javascript:FCMPlugin.onNotificationReceived({"collapse_key":"sa.tfe.oneteam","wasTapped":true,"google.original_priority":"high","google.delivered_priority":"high","from":"825633758297","google.message_id":"0:1554293018484380%dfdafb68dfdafb68","param1":"value1","param2":"value2"})
2019-04-03 17:33:55.432 4170-4170/sa.tfe.oneteam D/JsMessageQueue: Dropping Native->JS message due to disabled bridge
2019-04-03 17:33:55.455 4170-4177/sa.tfe.oneteam I/zygote: Do full code cache collection, code=252KB, data=214KB
2019-04-03 17:33:55.457 4170-4177/sa.tfe.oneteam I/zygote: After code cache collection, code=241KB, data=178KB
2019-04-03 17:33:55.493 4170-31193/sa.tfe.oneteam D/FA: Connected to remote service
2019-04-03 17:33:55.494 4170-31193/sa.tfe.oneteam V/FA: Processing queued up service tasks: 1
2019-04-03 17:33:55.495 4170-4170/sa.tfe.oneteam D/CordovaActivity: Started the activity.
2019-04-03 17:33:55.496 4170-4170/sa.tfe.oneteam D/CordovaActivity: Resumed the activity.
2019-04-03 17:33:55.510 4170-31193/sa.tfe.oneteam V/FA: Activity resumed, time: 188936819
2019-04-03 17:34:00.514 4170-31193/sa.tfe.oneteam V/FA: Inactivity, disconnecting from the service
2019-04-03 17:34:05.517 4170-31193/sa.tfe.oneteam V/FA: Session started, time: 188946840
2019-04-03 17:34:05.527 4170-31193/sa.tfe.oneteam D/FA: Logging event (FE): _s, Bundle[{_o=auto, _sc=MainActivity, _si=-1624274336331789161}]
2019-04-03 17:34:05.559 4170-31193/sa.tfe.oneteam V/FA: Using measurement service
2019-04-03 17:34:05.560 4170-31193/sa.tfe.oneteam V/FA: Connecting to remote service
2019-04-03 17:34:05.567 4170-31193/sa.tfe.oneteam D/FA: Connected to remote service
2019-04-03 17:34:05.568 4170-31193/sa.tfe.oneteam V/FA: Processing queued up service tasks: 1
2019-04-03 17:34:10.599 4170-31193/sa.tfe.oneteam V/FA: Inactivity, disconnecting from the service
...