Exclude or override AAR manifest

I am adding a library to my project. It comes in the form of AAR . But it has a BroadcastReceiver that listens to BOOT_COMPLETED , starts the service. I do not want this behavior in my application. I would like it to start from the moment the application starts. (This part has already been done using AAR , I assume the user force stopped the application).

Is there a way to change my manifest; or tell Gradle not to merge my manifest (in which I would have to declare my activity in my own manifest, I think); or override their manifest and have android:enabled="false for BroadcastReceiver "?

I would also like to do this in a manifest or Gradle , because if I do this programmatically and if they install the application but never open it, the library service will start automatically the next time the user reboots their phone.

+5
source share
2 answers

You can re-declare your BroadcastReceiver in your manifest and use android:enabled="false" and then tools:node = "replace" .

Also, if you later want to enable it, you can use the setComponentEnabledSetting() method inside the PackageManager .

+4
source

You can simply open the AAR file with WinRAR, or you can edit the manifest file yourself. AARs are simply packaged ZIP files, like APKs.

Indeed, Android Studio can handle this more elegantly, but I don’t know if this is still possible.

0
source

All Articles