Small auto start at boot/restart improvements
This commit is contained in:
@@ -130,12 +130,10 @@
|
|||||||
</service>
|
</service>
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".BootCompletedReceiver"
|
android:name=".BootCompletedReceiver" >
|
||||||
android:enabled="true"
|
|
||||||
android:exported="true"
|
|
||||||
android:permission="android.permission.RECEIVE_BOOT_COMPLETED" >
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
|
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ import androidx.core.app.NotificationCompat
|
|||||||
|
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
|
|
||||||
|
const val START_NOTIFICATION_IN = 105
|
||||||
|
|
||||||
class BootCompletedReceiver : BroadcastReceiver() {
|
class BootCompletedReceiver : BroadcastReceiver() {
|
||||||
|
|
||||||
override fun onReceive(context: Context, intent: Intent) {
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
@@ -42,7 +44,6 @@ class BootCompletedReceiver : BroadcastReceiver() {
|
|||||||
val channel = NotificationChannel("default", "default",
|
val channel = NotificationChannel("default", "default",
|
||||||
NotificationManager.IMPORTANCE_DEFAULT)
|
NotificationManager.IMPORTANCE_DEFAULT)
|
||||||
nm.createNotificationChannel(channel)
|
nm.createNotificationChannel(channel)
|
||||||
val START_NOTIFICATION_IN = 105
|
|
||||||
val pi = PendingIntent.getActivity(context, 0, i, PendingIntent.FLAG_ONE_SHOT)
|
val pi = PendingIntent.getActivity(context, 0, i, PendingIntent.FLAG_ONE_SHOT)
|
||||||
with(NotificationCompat.Builder(context, "default")) {
|
with(NotificationCompat.Builder(context, "default")) {
|
||||||
setSmallIcon(R.drawable.ic_stat)
|
setSmallIcon(R.drawable.ic_stat)
|
||||||
|
|||||||
Reference in New Issue
Block a user