Browse Source

Starts foreground service before stopping it to avoid app crash when listening to an audio file

Signed-off-by: Guillermo Mtz Espina <gmotzespina@icloud.com>
Guillermo Mtz Espina 3 years ago
parent
commit
12b75dce7b
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/main/java/com/nextcloud/client/media/PlayerService.kt

+ 2 - 1
src/main/java/com/nextcloud/client/media/PlayerService.kt

@@ -178,7 +178,8 @@ class PlayerService : Service() {
             player.stop(file)
         }
 
-        stopSelf()
+        startForeground(R.string.media_notif_ticker, notificationBuilder.build())
         stopForeground(true)
+        stopSelf();
     }
 }