Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 33


compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -39,6 +39,7 @@ android {

defaultConfig {
minSdkVersion 16
compileSdk 34
}
}

Expand Down
3 changes: 2 additions & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<application>
<service android:name=".WindowService" />
<service android:name=".WindowService" android:foregroundServiceType="specialUse" />
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Intent
import android.content.pm.ServiceInfo
import android.content.res.Configuration
import android.os.Build
import android.os.IBinder
Expand Down Expand Up @@ -47,7 +48,12 @@ class WindowService : android.app.Service() {
val y = intent.getIntExtra("y", 0)
androidWindow = AndroidWindow(this, focusable, width, height, x, y, engine)
androidWindow.open()
startForeground(1, getNotification())
val notification = getNotification()
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {
startForeground(1, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE)
} else {
startForeground(1, notification)
}
running = true
}
return super.onStartCommand(intent, flags, startId)
Expand Down