From f753d822ae2dfdc0df171b40121fb4ebede5460d Mon Sep 17 00:00:00 2001 From: Yuriy Liskov Date: Fri, 5 Dec 2025 02:07:21 +0200 Subject: [PATCH] remote control service fix on Android 12+ --- common/src/main/AndroidManifest.xml | 9 +++++++-- .../common/misc/RemoteControlReceiver.java | 11 ++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/common/src/main/AndroidManifest.xml b/common/src/main/AndroidManifest.xml index 9897cf2ce..dbe8c6778 100644 --- a/common/src/main/AndroidManifest.xml +++ b/common/src/main/AndroidManifest.xml @@ -45,8 +45,13 @@ - - + + diff --git a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/misc/RemoteControlReceiver.java b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/misc/RemoteControlReceiver.java index 3a349dc0e..46d63e098 100644 --- a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/misc/RemoteControlReceiver.java +++ b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/misc/RemoteControlReceiver.java @@ -3,6 +3,8 @@ package com.liskovsoft.smartyoutubetv2.common.misc; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.os.Build.VERSION; + import com.liskovsoft.sharedutils.mylogger.Log; import com.liskovsoft.smartyoutubetv2.common.utils.Utils; @@ -11,10 +13,13 @@ public class RemoteControlReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - Log.d(TAG, "Initializing remote control listener..."); + // Starting from Android 12 foreground service not supported + if (VERSION.SDK_INT < 31) { + Log.d(TAG, "Initializing remote control listener..."); - // Fix unload from the memory on some devices? - Utils.updateRemoteControlService(context); + // Fix unload from the memory on some devices? + Utils.updateRemoteControlService(context); + } //Utils.startRemoteControlWorkRequest(context);