From ead14e9a83ff3b9240ac46b001a7bf4559e47d81 Mon Sep 17 00:00:00 2001 From: Andrew nuark G Date: Wed, 8 Apr 2026 18:02:12 +0700 Subject: [PATCH] fix: moved important functions out of companion --- .../LiblinphoneFlutterPlugin.kt | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) 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}") - } - } } }