Added BaresipApp to avoid baresip service starting before baresip library is loaded
This commit is contained in:
@@ -40,6 +40,7 @@
|
|||||||
android:required="false" />
|
android:required="false" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
|
android:name=".BaresipApp"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:installLocation="internalOnly"
|
android:installLocation="internalOnly"
|
||||||
|
|||||||
@@ -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() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
|
|
||||||
Log.d(TAG, "BaresipService onCreate")
|
Log.i(TAG, "BaresipService onCreate")
|
||||||
|
|
||||||
intent = Intent("com.tutpro.baresip.EVENT")
|
intent = Intent("com.tutpro.baresip.EVENT")
|
||||||
intent.setPackage("com.tutpro.baresip")
|
intent.setPackage("com.tutpro.baresip")
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class MainActivity : ComponentActivity() {
|
|||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
val extraAction = intent.getStringExtra("action")
|
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)
|
window.addFlags(WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES)
|
||||||
|
|
||||||
@@ -409,12 +409,4 @@ class MainActivity : ComponentActivity() {
|
|||||||
exitProcess(0)
|
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