Fix RAISE_TO_FOREGROUND action

This commit is contained in:
sim 2024-12-22 10:44:30 +00:00
parent fc84f30d19
commit cce36d8151
2 changed files with 8 additions and 3 deletions

View file

@ -13,6 +13,12 @@
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> <!-- As of Android 13, we need to ask for permission to post notifications -->
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/> <!-- Allows to ignore battery optimization without going to the settings -->
<queries>
<intent>
<action android:name="org.unifiedpush.android.connector.RAISE_TO_FOREGROUND" />
</intent>
</queries>
<application
android:name=".app.Application"
android:allowBackup="true"

View file

@ -66,7 +66,7 @@ class RaiseAppToForeground(private val context: Context, private val app: String
scheduledFuture = unbindExecutor.schedule(this, 5L, TimeUnit.SECONDS)
return true
} else if (checkForeground()) {
Log.d(TAG, "Binding to $app/$TARGET_CLASS")
Log.d(TAG, "Binding to $app")
val intent = Intent().apply {
`package` = app
action = ACTION
@ -126,8 +126,7 @@ class RaiseAppToForeground(private val context: Context, private val app: String
private companion object {
private const val TAG = "RaiseAppToForeground"
private const val TARGET_CLASS = "org.unifiedpush.android.connector.RaiseToForegroundService"
private const val ACTION = "org.unifiedpush.android.distributor.RAISE_TO_FOREGROUND"
private const val ACTION = "org.unifiedpush.android.connector.RAISE_TO_FOREGROUND"
/** Executor to unbind 5 seconds later */
private val unbindExecutor = Executors.newSingleThreadScheduledExecutor()
}