无法根据 Android 10 ionic 中的通知启动应用程序

Unable to launch app on notification in Android 10 ionic

我正在使用 Ionic 开发混合应用程序。该应用程序正在通过 SIP 通信接收来电并且工作正常...除了 Android 10 台设备。

当应用程序处于 background/foreground 时,它会按预期运行。但是,当我杀死它时,它没有。

预期行为如下:

当前行为(Android 10)是:

Android Studio 中的痕迹是:

2020-02-05 17:29:01.591 7064-7117/com.qv.app D/Push_FCMService: onMessage - from: XXXXXXXXXXX
2020-02-05 17:29:01.592 7064-7117/com.qv.app D/Push_FCMService: sender id = XXXXXXXXXXXX
2020-02-05 17:29:01.592 7064-7117/com.qv.app D/Push_FCMService: normalize extras
2020-02-05 17:29:01.592 7064-7117/com.qv.app D/Push_FCMService: key = content-available
2020-02-05 17:29:01.592 7064-7117/com.qv.app D/Push_FCMService: replace key content-available with content-available
2020-02-05 17:29:01.592 7064-7117/com.qv.app D/Push_FCMService: key = force-start
2020-02-05 17:29:01.592 7064-7117/com.qv.app D/Push_FCMService: replace key force-start with force-start
2020-02-05 17:29:01.592 7064-7117/com.qv.app D/Push_FCMService: key = priority
2020-02-05 17:29:01.592 7064-7117/com.qv.app D/Push_FCMService: replace key priority with priority
2020-02-05 17:29:01.592 7064-7117/com.qv.app D/Push_FCMService: key = msg
2020-02-05 17:29:01.592 7064-7117/com.qv.app D/Push_FCMService: replace key msg with msg
2020-02-05 17:29:01.592 7064-7117/com.qv.app D/Push_FCMService: key = notId
2020-02-05 17:29:01.593 7064-7117/com.qv.app D/Push_FCMService: replace key notId with notId
2020-02-05 17:29:01.593 7064-7117/com.qv.app D/Push_FCMService: key = title
2020-02-05 17:29:01.593 7064-7117/com.qv.app D/Push_FCMService: replace key title with title
2020-02-05 17:29:01.593 7064-7117/com.qv.app D/Push_FCMService: no locale found for key = title, error Value Qvadis of type java.lang.String cannot be converted to JSONObject
2020-02-05 17:29:01.593 7064-7117/com.qv.app D/Push_FCMService: key = coldstart
2020-02-05 17:29:01.593 7064-7117/com.qv.app D/Push_FCMService: replace key coldstart with coldstart
2020-02-05 17:29:01.593 7064-7117/com.qv.app D/Push_FCMService: key = visibility
2020-02-05 17:29:01.593 7064-7117/com.qv.app D/Push_FCMService: replace key visibility with visibility
2020-02-05 17:29:01.593 7064-7117/com.qv.app D/Push_FCMService: background
2020-02-05 17:29:01.593 7064-7117/com.qv.app D/Push_FCMService: message =[null]
2020-02-05 17:29:01.593 7064-7117/com.qv.app D/Push_FCMService: title =[TestTitle]
2020-02-05 17:29:01.593 7064-7117/com.qv.app D/Push_FCMService: contentAvailable =[1]
2020-02-05 17:29:01.593 7064-7117/com.qv.app D/Push_FCMService: forceStart =[1]
2020-02-05 17:29:01.593 7064-7117/com.qv.app D/Push_FCMService: create notification
2020-02-05 17:29:01.612 7064-7117/com.qv.app D/Push_FCMService: Using channel ID = PushPluginChannel
2020-02-05 17:29:01.620 7064-7117/com.qv.app D/Push_FCMService: stored icon=null
2020-02-05 17:29:01.620 7064-7117/com.qv.app D/Push_FCMService: stored iconColor=null
2020-02-05 17:29:01.620 7064-7117/com.qv.app D/Push_FCMService: stored sound=true
2020-02-05 17:29:01.620 7064-7117/com.qv.app D/Push_FCMService: stored vibrate=true
2020-02-05 17:29:01.620 7064-7117/com.qv.app D/Push_FCMService: no icon resource found - using application icon
2020-02-05 17:29:01.621 7064-7117/com.qv.app D/Push_FCMService: create actions: with in-line
2020-02-05 17:29:01.626 7064-7117/com.qv.app D/Push_FCMService: app is not running but we should start it and put in background
2020-02-05 17:29:01.627 7064-7117/com.qv.app I/Timeline: Timeline: Activity_launch_request time:6280056
2020-02-05 17:29:01.634 7064-7088/com.qv.app W/com.qvadis.app: Reducing the number of considered missed Gc histogram windows from 147 to 100

这是我用于通知的语法:

{"registration_ids":["..xxxx..."], "data":{"visibility":"-1","content-available": "1", "force-start": "1", "priority": 2, "message": "msgTest", "notId": "24", "title": "titleTest"}, "priority":"high" }

有什么想法吗?你们以前有没有遇到过这个问题?如果您需要更多信息,请随时询问,我很乐意回答。

编辑:这些是 Android 给出的关于 Android 10 https://developer.android.com/guide/components/activities/background-starts

开始活动限制的指导方针

非常感谢您, 博尔哈

我已经找到了解决方法。

就我而言,我必须做两件不同的事情:

通过这两件事,我能够启动应用程序并显示 cordova 调用 UI。