File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
common/src/main/java/com/liskovsoft/smartyoutubetv2/common/misc Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 11package com .liskovsoft .smartyoutubetv2 .common .misc ;
22
3+ import android .annotation .SuppressLint ;
34import android .content .BroadcastReceiver ;
45import android .content .Context ;
56import android .content .Intent ;
1011public class RemoteControlReceiver extends BroadcastReceiver {
1112 private static final String TAG = RemoteControlReceiver .class .getSimpleName ();
1213
14+ @ SuppressLint ("UnsafeProtectedBroadcastReceiver" )
1315 @ Override
1416 public void onReceive (Context context , Intent intent ) {
1517 Log .d (TAG , "Initializing remote control listener..." );
1618
1719 // Fix unload from the memory on some devices?
1820 // NOTE: Starting from Android 12 (api 31) foreground service with type 'connectedDevice' not supported
1921 // Use 'mediaPlayback' type instead
20- Utils . updateRemoteControlService ( context );
21-
22- //Utils.startRemoteControlWorkRequest(context);
23-
24- // Couldn't success inside periodic work request
25- //PlaybackPresenter.instance(context); // init RemoteControlListener
22+ try {
23+ Utils . updateRemoteControlService ( context );
24+ } catch ( Exception e ) {
25+ // ForegroundServiceStartNotAllowedException: startForegroundService() not allowed due to mAllowStartForeground false (Android 12)
26+ e . printStackTrace ();
27+ }
2628 }
2729}
You can’t perform that action at this time.
0 commit comments