Start at boot
This commit is contained in:
parent
9fadb5ca9a
commit
eafa520112
@ -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"
|
||||||
|
15
app/src/main/java/net/mezimmah/catflipscreen/MyReceiver.kt
Normal file
15
app/src/main/java/net/mezimmah/catflipscreen/MyReceiver.kt
Normal 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")
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user