File tree Expand file tree Collapse file tree 3 files changed +49
-0
lines changed
kotlin/com/simplemobiletools/notes/pro/receivers Expand file tree Collapse file tree 3 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 107107 android : resource =" @xml/widget_info" />
108108 </receiver >
109109
110+ <receiver
111+ android : name =" .receivers.BootCompletedReceiver"
112+ android : exported =" true" >
113+
114+ <intent-filter >
115+ <action android : name =" android.intent.action.BOOT_COMPLETED" />
116+ <action android : name =" android.intent.action.QUICKBOOT_POWERON" />
117+ <action android : name =" com.htc.intent.action.QUICKBOOT_POWERON" />
118+ <action android : name =" android.intent.action.MY_PACKAGE_REPLACED" />
119+ </intent-filter >
120+ </receiver >
121+
122+ <receiver
123+ android : name =" .receivers.AutomaticBackupReceiver"
124+ android : exported =" false" />
125+
110126 <activity-alias
111127 android : name =" .activities.SplashActivity.Red"
112128 android : enabled =" false"
Original file line number Diff line number Diff line change 1+ package com.simplemobiletools.notes.pro.receivers
2+
3+ import android.content.BroadcastReceiver
4+ import android.content.Context
5+ import android.content.Intent
6+ import android.os.PowerManager
7+
8+ class AutomaticBackupReceiver : BroadcastReceiver () {
9+
10+ override fun onReceive (context : Context , intent : Intent ) {
11+ val powerManager = context.getSystemService(Context .POWER_SERVICE ) as PowerManager
12+ val wakelock = powerManager.newWakeLock(PowerManager .PARTIAL_WAKE_LOCK , " simplenotes:automaticbackupreceiver" )
13+ wakelock.acquire(3000 )
14+ context.backupNotes()
15+ }
16+ }
Original file line number Diff line number Diff line change 1+ package com.simplemobiletools.notes.pro.receivers
2+
3+ import android.content.BroadcastReceiver
4+ import android.content.Context
5+ import android.content.Intent
6+ import com.simplemobiletools.commons.helpers.ensureBackgroundThread
7+
8+ class BootCompletedReceiver : BroadcastReceiver () {
9+
10+ override fun onReceive (context : Context , intent : Intent ) {
11+ ensureBackgroundThread {
12+ context.apply {
13+ checkAndBackupNotesOnBoot()
14+ }
15+ }
16+ }
17+ }
You can’t perform that action at this time.
0 commit comments