Как разрешить автозапуск в Android 10?
Пишу приложение которое должно автоматически запускаться вместе с системой. Android 10 этого не позволяет пока пользователь не передвинет вот этот тумблер "Автозапуск". Тестировал в эмуляторе, там всё успешно запускается бродкаст и все уведомления. На реальном устройстве эта проблема. Спасибо заранее! Помогите пожалуйста)
Вот тот самый тумблер "Автозапуск".
Мой код: Receiver
<receiver
android:name="com.chistoedet.android.demonotifacation.BootCompletedIntentReceiver"
android:exported="true"
android:enabled="true"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED"
>
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.REBOOT" />
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
Broadcast:
class BootCompletedIntentReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
StringBuilder().apply {
append("Action: ${intent.action}\n")
append("URI: ${intent.toUri(Intent.URI_INTENT_SCHEME)}\n")
toString().also { log ->
Log.d("RECEIVER123", log)
showNotification(context,intent)
Toast.makeText(context, log, Toast.LENGTH_LONG).show()
}
}}
