mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-18 03:48:08 +00:00
Added back the app updated broadcast receiver to restart it automatically like after a boot
This commit is contained in:
parent
463c8dda8e
commit
39615b92c1
2 changed files with 9 additions and 0 deletions
|
|
@ -173,6 +173,7 @@
|
|||
<receiver android:name=".core.BootReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,14 @@ class BootReceiver : BroadcastReceiver() {
|
|||
serviceIntent.putExtra("StartForeground", true)
|
||||
ContextCompat.startForegroundService(context, serviceIntent)
|
||||
}
|
||||
} else if (intent.action.equals(Intent.ACTION_MY_PACKAGE_REPLACED, ignoreCase = true)) {
|
||||
val autoStart = corePreferences.autoStart
|
||||
Log.i("[Boot Receiver] App has been updated, autoStart is $autoStart")
|
||||
if (autoStart) {
|
||||
val serviceIntent = Intent(Intent.ACTION_MAIN).setClass(context, CoreService::class.java)
|
||||
serviceIntent.putExtra("StartForeground", true)
|
||||
ContextCompat.startForegroundService(context, serviceIntent)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue