File tree Expand file tree Collapse file tree 1 file changed +3
-13
lines changed
common/src/main/java/com/liskovsoft/smartyoutubetv2/common/misc Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -36,20 +36,10 @@ public void onCreate() {
3636 // NOTE: it's impossible to hide notification on Android 9 and above
3737 // https://stackoverflow.com/questions/10962418/how-to-startforeground-without-showing-notification
3838 try {
39- //if (AppInfoHelpers.getRealSdkVersion(this) >= 34) { // Fix ForegroundServiceStartNotAllowedException
40- // // Tie service to active media session
41- // MediaSessionCompat mediaSession = new MediaSessionCompat(this, TAG);
42- // mediaSession.setActive(true);
43- //}
44-
45- if (VERSION .SDK_INT >= 34 ) {
46- // Fix ForegroundServiceStartNotAllowedException on Android 14?
47- startForeground (NOTIFICATION_ID , createNotification (), ServiceInfo .FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK );
48- } else {
49- startForeground (NOTIFICATION_ID , createNotification ());
50- }
51- } catch (NullPointerException e ) {
39+ startForeground (NOTIFICATION_ID , createNotification ());
40+ } catch (Exception e ) {
5241 // NullPointerException: Attempt to read from field 'int com.android.server.am.UidRecord.curProcState' on a null object reference
42+ // ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false (Android 14)
5343 e .printStackTrace ();
5444 }
5545 }
You can’t perform that action at this time.
0 commit comments