diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt index 332a02ec..e28be3b9 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt @@ -315,14 +315,14 @@ class BaresipService: Service() { override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { - val action: String? + val action: String if (intent == null) { action = "Start" Log.d(TAG, "Received onStartCommand with null intent") } else { // Utils.dumpIntent(intent) - action = intent.action + action = intent.action!! Log.d(TAG, "Received onStartCommand action $action") } diff --git a/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt b/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt index eba979a7..8633ab6e 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt @@ -927,9 +927,7 @@ class MainActivity : AppCompatActivity() { Log.d(TAG, "Handling service event 'started' with '$callActionUri'") if (!this::uaAdapter.isInitialized) { // Android has restarted baresip when permission has been denied in app settings - val i = Intent(this, MainActivity::class.java) - i.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK - startActivity(i) + recreate() return } uaAdapter.notifyDataSetChanged()