Added BaresipApp to avoid baresip service starting before baresip library is loaded
This commit is contained in:
@ -40,6 +40,7 @@
|
||||
android:required="false" />
|
||||
|
||||
<application
|
||||
android:name=".BaresipApp"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:installLocation="internalOnly"
|
||||
|
||||
15
app/src/main/kotlin/com/tutpro/baresip/BaresipApp.kt
Normal file
15
app/src/main/kotlin/com/tutpro/baresip/BaresipApp.kt
Normal file
@ -0,0 +1,15 @@
|
||||
package com.tutpro.baresip
|
||||
|
||||
import android.app.Application
|
||||
|
||||
class BaresipApp : Application() {
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
if (!BaresipService.libraryLoaded) {
|
||||
Log.i(TAG, "Loading baresip library")
|
||||
System.loadLibrary("baresip")
|
||||
BaresipService.libraryLoaded = true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -124,7 +124,7 @@ class BaresipService: Service() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
||||
Log.d(TAG, "BaresipService onCreate")
|
||||
Log.i(TAG, "BaresipService onCreate")
|
||||
|
||||
intent = Intent("com.tutpro.baresip.EVENT")
|
||||
intent.setPackage("com.tutpro.baresip")
|
||||
|
||||
@ -66,7 +66,7 @@ class MainActivity : ComponentActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
val extraAction = intent.getStringExtra("action")
|
||||
Log.e(TAG, "Main onCreate ${intent.action}/${intent.data}/$extraAction")
|
||||
Log.i(TAG, "Main onCreate ${intent.action}/${intent.data}/$extraAction")
|
||||
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES)
|
||||
|
||||
@ -409,12 +409,4 @@ class MainActivity : ComponentActivity() {
|
||||
exitProcess(0)
|
||||
}
|
||||
|
||||
init {
|
||||
if (!BaresipService.libraryLoaded) {
|
||||
Log.d(TAG, "Loading baresip library")
|
||||
System.loadLibrary("baresip")
|
||||
BaresipService.libraryLoaded = true
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user