From b35c88a9fd17a3e5f5036910a0bc2c89f06caff1 Mon Sep 17 00:00:00 2001 From: Leonardo Castro Date: Mon, 28 Jun 2021 17:29:19 -0300 Subject: [PATCH 1/3] CreateWindow This will create the bubble. I don't know if it's the right thing to do, but works for me. --- .../devotion/floaty_head/services/FloatyContentJobService.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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..8a2e1a5 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,7 @@ class FloatyContentJobService : Service() { instance = this createNotificationChannel() showNotificationManager() + createWindow() } override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { @@ -147,4 +148,4 @@ class FloatyContentJobService : Service() { } private fun setWindowManager() = windowManager ?: run { windowManager = getSystemService(WINDOW_SERVICE) as WindowManager } -} \ No newline at end of file +} From 5abf665b0844e94d41802e9c94f90765ce7f3e9d Mon Sep 17 00:00:00 2001 From: Leonardo Castro Date: Tue, 29 Jun 2021 18:41:37 -0300 Subject: [PATCH 2/3] CreateWindow for Android 11 --- .../devotion/floaty_head/services/FloatyContentJobService.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 8a2e1a5..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,7 +36,9 @@ class FloatyContentJobService : Service() { instance = this createNotificationChannel() showNotificationManager() - createWindow() + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + createWindow() + } } override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { From ad1a5468fbdcc58cb9d0315f527018bf252bdae3 Mon Sep 17 00:00:00 2001 From: Leonardo Castro Date: Tue, 29 Jun 2021 18:44:54 -0300 Subject: [PATCH 3/3] Adding Android 11 to close --- .../src/main/kotlin/ni/devotion/floaty_head/FloatyHeadPlugin.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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))