Denial permission OPPO_COMPONENT_SAFE
Asked Answered
F

1

11

I have service in my app which needs to be running in background in device OPPO. I have read somewhere that we need to enable auto start in settings for app to keep service running but I have a problem with permission.

java.lang.SecurityException: Permission Denial: starting Intent { cmp=com.coloros.safecenter/.startupapp.StartupAppListActivity } from ProcessRecord{904a19d 12604:elite.driver.adsmove.com.settingpermission/u0a214} (pid=12604, uid=10214) requires oppo.permission.OPPO_COMPONENT_SAFE

When i try to do this

if (Build.MANUFACTURER.equals("OPPO")) {
    Intent[] AUTO_START_OPPO = {
        new Intent().setComponent(new ComponentName("com.coloros.safe", "com.coloros.safe.permission.startup.StartupAppListActivity")),
        new Intent().setComponent(new ComponentName("com.coloros.safe", "com.coloros.safe.permission.startupapp.StartupAppListActivity")),
        new Intent().setComponent(new ComponentName("com.coloros.safecenter", "com.coloros.safecenter.startupapp.StartupAppListActivity")),
        new Intent().setComponent(new ComponentName("com.coloros.safecenter", "com.coloros.safecenter.startup.StartupAppListActivity"))
    };

    for (Intent intent : AUTO_START_OPPO) {
        if (getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) != null) {
            try {
                startActivity(intent);
                break;
            } catch (Exception e) {
                Log.d(TAG, "OPPO - Exception: "+  e.toString());
            }
        }
    }
}

I also tried to add permission and request it but failed

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

Looking forward to help from those who have experience about it, thank you!

Foretopsail answered 13/4, 2018 at 10:21 Comment(9)
I hope you have found answers @rameshyoguSvoboda
Did you found any solution ?Claudy
Until now, I haven't found any solution to this either... It is really concerning.Andry
have you found any solutions for this issue ?Expedition
yes, I have found it and solve my problem!Svoboda
the answer here: github.com/HOMINHTUNG/Permission-Oppo-Android. @ClaudySvoboda
you solved the problem yet @ExpeditionSvoboda
you solved the problem yet @JonathanLionoSvoboda
I have OPPO A5s version 8.1.0, ColorOS version 5.2.1 , I am able to navigate to StartupManager but after I have enabled the autoStartUp , still my WorkManager is not runningRa
C
1

Try adding the following As the Component name

ComponentName("com.coloros.safecenter", "com.coloros.privacypermissionsentry.PermissionTopActivity")

Worked For OPPO A3 Device

Cakewalk answered 30/11, 2020 at 16:24 Comment(1)
This is working for Oppo A1601 running Android 6.0 tooPhotographer

© 2022 - 2024 — McMap. All rights reserved.