judemanutd / AutoStarter

This library helps bring up the autostart permission manager of a phone to the user so they can add an app to autostart.
MIT License
623 stars 114 forks source link

Auto Start Permission not working on oneplus device #87

Open shaikhsiddik opened 1 year ago

shaikhsiddik commented 1 year ago

Hello every one, i need small favour so i'm trying to add permission for auto start but auto start screen not opening. if any one achieve the result on oneplus please help me. thanks in advance

RandomEngy commented 10 months ago

It's currently searching for the package com.oneplus.security which does not appear on my OnePlus 8 device.

I believe the auto-launch is configured with the package com.oplus.battery and activity com.oplus.startupapp.view.StartupAppListActivity.

However when I try to launch that Intent I get:

java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.oplus.battery/com.oplus.startupapp.view.StartupAppListActivity mCallingUid=10501 } from ProcessRecord{9d50baa 26557:net.focalist/u0a501} (pid=26557, uid=10501) requires oplus.permission.OPLUS_COMPONENT_SAFE

I tried adding <uses-permission android:name="oplus.permission.OPLUS_COMPONENT_SAFE"/> to the manifest but that didn't work.

rayworks commented 2 weeks ago

Hi @RandomEngy, I've come across the same issue on a oneplus device when dealing with the push notification. I think now days the device manufactures take more aggressive strategies against the permission request from apps.

However, there is another way to do it instead of requesting to change the startup option. According to the Android developer doc, we could ask for disabling the battery optimization by requesting REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission, but Google seems reluctant to allow apps to use this action. See also here and here.

RandomEngy commented 1 week ago

I've given up and taken an alternate path.