Oppo Firebase通知在后台

时间:2019-05-28 06:31:54

标签: android kotlin permissions oppo

权限代码oppo无法加载应用。 Oppo手机无法在后台处理通知, 但是当我使用这些代码时,效果很好:

val POWERMANAGER_INTENTS = arrayOf(
        Intent().setComponent(
            ComponentName(
                "com.coloros.safecenter",
                "com.coloros.safecenter.permission.startup.StartupAppListActivity"
            )
        ),
        Intent().setComponent(
            ComponentName(
                "com.coloros.safecenter",
                "com.coloros.safecenter.startupapp.StartupAppListActivity"
            )
        )
    )

但是此代码导致我的应用无法加载。这样的错误:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.firebasesms.hong/com.firebasesms.hong.MainActivity}: java.lang.SecurityException: Permission Denial: starting Intent.......

Caused by: java.lang.SecurityException: Permission Denial: starting Intent ..... requires oppo.permission.OPPO_COMPONENT_SAFE

AndroidManifest

enter image description here

代码:Kotlin

enter image description here

错误:需要oppo.permission.OPPO_COMPONENT_SAFE

enter image description here

1 个答案:

答案 0 :(得分:0)

您需要在清单中具有“ OPPO_COMPONENT_SAFE”权限才能启动Intent。

    <!--for OPPO-->
<uses-permission android:name="oppo.permission.OPPO_COMPONENT_SAFE" />

参考:Denial permission OPPO_COMPONENT_SAFE