diff --git a/android/src/main/kotlin/xyz/nuark/liblinphone_flutter/LiblinphoneFlutterPlugin.kt b/android/src/main/kotlin/xyz/nuark/liblinphone_flutter/LiblinphoneFlutterPlugin.kt index e8b6031..4b8e5ea 100644 --- a/android/src/main/kotlin/xyz/nuark/liblinphone_flutter/LiblinphoneFlutterPlugin.kt +++ b/android/src/main/kotlin/xyz/nuark/liblinphone_flutter/LiblinphoneFlutterPlugin.kt @@ -242,30 +242,30 @@ class LiblinphoneFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler } return null } + + 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" - - 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}") - } - } } }