From eebf20b08c44b09fedb081d26203baf3c5919bd1 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 7 Nov 2026 07:48:52 +0100 Subject: [PATCH] hyperroid:: fixes to keep-in-memory notifications for newer Android --- hyperroid/app/src/main/AndroidManifest.xml | 9 +++++++- .../hyperroid/ForegroundService.java | 6 +++-- .../com/roguetemple/hyperroid/HyperRogue.java | 22 +++++++++++++++---- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/hyperroid/app/src/main/AndroidManifest.xml b/hyperroid/app/src/main/AndroidManifest.xml index 69dfbbb5..35bb4c4d 100644 --- a/hyperroid/app/src/main/AndroidManifest.xml +++ b/hyperroid/app/src/main/AndroidManifest.xml @@ -6,6 +6,8 @@ + + @@ -25,7 +27,12 @@ android:name=".HyperSettings"> - + + = Build.VERSION_CODES.S) { + try { + startForegroundService(startIntent); + } catch (ForegroundServiceStartNotAllowedException e) { + Log.e("HyperRogue", "Cannot start foreground service", e); + } + } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + startForegroundService(startIntent); + } else { + startService(startIntent); + } } else { - Intent stopIntent = new Intent(HyperRogue.this, ForegroundService.class); - stopIntent.setAction(ForegroundService.STOPFOREGROUND_ACTION); - startService(stopIntent); + // Intent stopIntent = new Intent(HyperRogue.this, ForegroundService.class); + // stopIntent.setAction(ForegroundService.STOPFOREGROUND_ACTION); + // startService(stopIntent); + stopService(new Intent(HyperRogue.this, ForegroundService.class)); } if (backgroundmusic != null) backgroundmusic.stop();