'How to start the service after restarting the device on Android 11?
I want to start the service after restarting or turning on the device. At the moment everything works fine on my Android 8.1 device. But the Android 11 device does not launch my service, I do not get any errors. Here is my code:
Manifest file:
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<service
android:name=".service.ServiceManager"
android:exported="false" />
<receiver
android:name=".receiver.AutoRebootReceiver"
android:enabled="true"
android:exported="true"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<intent-filter android:priority="99999">
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.SCREEN_ON" />
<action android:name="android.net.wifi.WIFI_STATE_CHANGED" />
</intent-filter>
</receiver>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
