remote control service fix on Android 12+

This commit is contained in:
Yuriy Liskov
2025-12-05 02:07:21 +02:00
parent b9840322d1
commit f753d822ae
2 changed files with 15 additions and 5 deletions

View File

@@ -45,8 +45,13 @@
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
</intent-filter>
</receiver>
<service android:name="com.liskovsoft.smartyoutubetv2.common.misc.RemoteControlService" android:enabled="true"/>
<service android:name="com.liskovsoft.smartyoutubetv2.common.misc.BackgroundPlaybackService" android:enabled="true"/>
<service
android:name="com.liskovsoft.smartyoutubetv2.common.misc.RemoteControlService"
android:enabled="true"
android:foregroundServiceType="connectedDevice"/>
<service
android:name="com.liskovsoft.smartyoutubetv2.common.misc.BackgroundPlaybackService"
android:enabled="true"/>
<activity android:name=".misc.BackupReceiverActivity"
android:exported="true">

View File

@@ -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);