fix: moved important functions out of companion

This commit is contained in:
Andrew 2026-04-08 18:02:12 +07:00
parent e9e07a3415
commit ead14e9a83

View file

@ -243,29 +243,29 @@ class LiblinphoneFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler
return null
}
companion object {
const val TAG = "LiblinphoneFlutterPlugin"
private fun startCallService() {
try {
val intent = Intent(activity.applicationContext, LinphoneVoipService::class.java)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
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}")
private fun startCallService() {
try {
val intent = Intent(activity.applicationContext, LinphoneVoipService::class.java)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
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}")
}
}
companion object {
const val TAG = "LiblinphoneFlutterPlugin"
}
}