diff --git a/android/src/main/kotlin/ni/devotion/floaty_head/FloatyHeadPlugin.kt b/android/src/main/kotlin/ni/devotion/floaty_head/FloatyHeadPlugin.kt index 9594272..a3a1251 100644 --- a/android/src/main/kotlin/ni/devotion/floaty_head/FloatyHeadPlugin.kt +++ b/android/src/main/kotlin/ni/devotion/floaty_head/FloatyHeadPlugin.kt @@ -200,7 +200,7 @@ class FloatyHeadPlugin : ActivityAware, FlutterPlugin, MethodChannel.MethodCallH "close" -> { if(mBound){ FloatyContentJobService.instance!!.closeWindow(true) - if(Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q){ + if(Build.VERSION.SDK_INT <= Build.VERSION_CODES.R){ activity?.stopService(Intent(activity?.applicationContext, FloatyContentJobService::class.java)) }else{ activity?.startForegroundService(Intent(activity?.applicationContext, FloatyContentJobService::class.java)) diff --git a/android/src/main/kotlin/ni/devotion/floaty_head/services/FloatyContentJobService.kt b/android/src/main/kotlin/ni/devotion/floaty_head/services/FloatyContentJobService.kt index 7a228ec..298198b 100644 --- a/android/src/main/kotlin/ni/devotion/floaty_head/services/FloatyContentJobService.kt +++ b/android/src/main/kotlin/ni/devotion/floaty_head/services/FloatyContentJobService.kt @@ -36,6 +36,9 @@ class FloatyContentJobService : Service() { instance = this createNotificationChannel() showNotificationManager() + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + createWindow() + } } override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { @@ -147,4 +150,4 @@ class FloatyContentJobService : Service() { } private fun setWindowManager() = windowManager ?: run { windowManager = getSystemService(WINDOW_SERVICE) as WindowManager } -} \ No newline at end of file +}