- Let user fix the Settings that prevented baresip from starting.
This commit is contained in:
@@ -847,12 +847,6 @@ class BaresipService: Service() {
|
||||
fun stopped(error: String) {
|
||||
Log.d(LOG_TAG, "Received 'stopped' from baresip with param '$error'")
|
||||
isServiceRunning = false
|
||||
if (error == "ua_init") {
|
||||
Config.removeVariable("sip_listen")
|
||||
Config.removeVariable("net_interface")
|
||||
Config.removeVariable("sip_certificate")
|
||||
Config.removeVariable("sip_cafile")
|
||||
}
|
||||
val intent = Intent("service event")
|
||||
intent.putExtra("event", "stopped")
|
||||
intent.putExtra("params", arrayListOf(error))
|
||||
|
||||
@@ -587,22 +587,16 @@ class MainActivity : AppCompatActivity() {
|
||||
alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, getString(R.string.ok)
|
||||
) { dialog, _ ->
|
||||
dialog.dismiss()
|
||||
quitTimer.cancel()
|
||||
finishAndRemoveTask()
|
||||
System.exit(0)
|
||||
//quitTimer.cancel()
|
||||
//finishAndRemoveTask()
|
||||
//System.exit(0)
|
||||
}
|
||||
alertDialog.show()
|
||||
return
|
||||
} else {
|
||||
quitTimer.cancel()
|
||||
finishAndRemoveTask()
|
||||
if (restart) {
|
||||
Log.d("Baresip", "Trigger restart")
|
||||
val restartActivity = Intent(applicationContext, MainActivity::class.java)
|
||||
val restartIntent = PendingIntent.getActivity(applicationContext,
|
||||
RESTART_REQUEST_CODE, restartActivity, PendingIntent.FLAG_CANCEL_CURRENT)
|
||||
val am = applicationContext.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
am.set(AlarmManager.RTC,System.currentTimeMillis() + 1000, restartIntent)
|
||||
}
|
||||
if (restart) reStart()
|
||||
System.exit(0)
|
||||
return
|
||||
}
|
||||
@@ -839,10 +833,14 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
/*override fun onStop() {
|
||||
super.onStop()
|
||||
Log.d("Baresip", "Main stopped")
|
||||
}*/
|
||||
private fun reStart() {
|
||||
Log.d("Baresip", "Trigger restart")
|
||||
val restartActivity = Intent(applicationContext, MainActivity::class.java)
|
||||
val restartIntent = PendingIntent.getActivity(applicationContext,
|
||||
RESTART_REQUEST_CODE, restartActivity, PendingIntent.FLAG_CANCEL_CURRENT)
|
||||
val am = applicationContext.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
am.set(AlarmManager.RTC,System.currentTimeMillis() + 1000, restartIntent)
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
moveTaskToBack(true)
|
||||
@@ -937,6 +935,7 @@ class MainActivity : AppCompatActivity() {
|
||||
quitTimer.start()
|
||||
} else {
|
||||
finishAndRemoveTask()
|
||||
if (reStart) reStart()
|
||||
System.exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user