Use recreate() to recreae Main Activity after restart by Android
This commit is contained in:
@ -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")
|
||||
}
|
||||
|
||||
|
||||
@ -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()
|
||||
|
||||
Reference in New Issue
Block a user