run RunOnStartup also on Restart action
This commit is contained in:
@@ -108,7 +108,8 @@
|
|||||||
android:value="com.tutpro.baresip.MainActivity" />
|
android:value="com.tutpro.baresip.MainActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<service android:name=".BaresipService" >
|
<service android:name=".BaresipService"
|
||||||
|
android:enabled="true" >
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
@@ -118,6 +119,7 @@
|
|||||||
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
|
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="com.tutpro.baresip.Restart" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,14 @@ import android.content.BroadcastReceiver
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
|
|
||||||
class RunOnStartup : BroadcastReceiver() {
|
class RunOnStartup : BroadcastReceiver() {
|
||||||
|
|
||||||
override fun onReceive(context: Context, intent: Intent) {
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
if (intent.action == Intent.ACTION_BOOT_COMPLETED) {
|
if ((intent.action == Intent.ACTION_BOOT_COMPLETED) or
|
||||||
|
(intent.action == "com.tutpro.baresip.Restart")) {
|
||||||
|
Log.d("Baresip", "Start baresip upon boot completed or restart")
|
||||||
val i = Intent(context, MainActivity::class.java)
|
val i = Intent(context, MainActivity::class.java)
|
||||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
val b = Bundle()
|
val b = Bundle()
|
||||||
|
|||||||
Reference in New Issue
Block a user