mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
Added receivers to manifest
This commit is contained in:
@ -0,0 +1,17 @@
|
||||
package com.simplemobiletools.contacts.pro.receivers
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.PowerManager
|
||||
import com.simplemobiletools.contacts.pro.extensions.backupContacts
|
||||
|
||||
class AutomaticBackupReceiver : BroadcastReceiver() {
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
val powerManager = context.getSystemService(Context.POWER_SERVICE) as PowerManager
|
||||
val wakelock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "simplecontacts:automaticbackupreceiver")
|
||||
wakelock.acquire(3000)
|
||||
context.backupContacts()
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.simplemobiletools.contacts.pro.receivers
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
import com.simplemobiletools.contacts.pro.extensions.checkAndBackupContactsOnBoot
|
||||
|
||||
class BootCompletedReceiver : BroadcastReceiver() {
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
ensureBackgroundThread {
|
||||
context.apply {
|
||||
checkAndBackupContactsOnBoot()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user