Start at boot

This commit is contained in:
Talmid of Levi 2023-11-22 16:33:27 -05:00
parent 9fadb5ca9a
commit eafa520112
2 changed files with 25 additions and 0 deletions

View File

@ -2,6 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application <application
android:allowBackup="true" android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules" android:dataExtractionRules="@xml/data_extraction_rules"
@ -12,6 +14,14 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.CatFlipScreen" android:theme="@style/Theme.CatFlipScreen"
tools:targetApi="31"> tools:targetApi="31">
<receiver
android:name=".MyReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<service <service
android:name=".FlipScreenService" android:name=".FlipScreenService"

View File

@ -0,0 +1,15 @@
package net.mezimmah.catflipscreen
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.util.Log
class MyReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
context.startForegroundService(Intent(context, FlipScreenService::class.java))
Log.i("Autostart", "started")
}
}