fix: moved important functions out of companion
This commit is contained in:
parent
e9e07a3415
commit
ead14e9a83
1 changed files with 22 additions and 22 deletions
|
|
@ -243,29 +243,29 @@ class LiblinphoneFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
private fun startCallService() {
|
||||||
const val TAG = "LiblinphoneFlutterPlugin"
|
try {
|
||||||
|
val intent = Intent(activity.applicationContext, LinphoneVoipService::class.java)
|
||||||
private fun startCallService() {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
try {
|
activity.startForegroundService(intent)
|
||||||
val intent = Intent(activity.applicationContext, LinphoneVoipService::class.java)
|
} else {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
activity.startService(intent)
|
||||||
activity.startForegroundService(intent)
|
|
||||||
} else {
|
|
||||||
activity.startService(intent)
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.e(TAG, "Failed to start call service: ${e.message}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun stopCallService() {
|
|
||||||
try {
|
|
||||||
val intent = Intent(activity.applicationContext, LinphoneVoipService::class.java)
|
|
||||||
activity.stopService(intent)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.e(TAG, "Failed to stop call service: ${e.message}")
|
|
||||||
}
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e(TAG, "Failed to start call service: ${e.message}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun stopCallService() {
|
||||||
|
try {
|
||||||
|
val intent = Intent(activity.applicationContext, LinphoneVoipService::class.java)
|
||||||
|
activity.stopService(intent)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e(TAG, "Failed to stop call service: ${e.message}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val TAG = "LiblinphoneFlutterPlugin"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue