Pārlūkot izejas kodu

changed killing method to kill app.

yattoz 4 gadus atpakaļ
vecāks
revīzija
19390f508e

+ 4 - 3
app/src/main/java/fr/forum_thalie/tsumugi/RadioService.kt Parādīt failu

@@ -233,7 +233,7 @@ class RadioService : MediaBrowserServiceCompat() {
233 233
             Actions.NOTIFY.name -> nowPlayingNotification.update(this)
234 234
             Actions.PLAY_OR_FALLBACK.name -> beginPlayingOrFallback()
235 235
             Actions.FADE_OUT.name -> {
236
-                for (i in 1 until 30) // we schedule 30 "LowerVolumeRunnable" every 2 seconds (i * 2)
236
+                for (i in 1 until 28) // we schedule 28 "LowerVolumeRunnable" every 2 seconds (i * 2)
237 237
                 {
238 238
                     // I couldn't find how to send multiple times the same PendingIntent using AlarmManager, so I relied on Handler instead.
239 239
                     // I think there's no guarantee of exact time with the Handler, especially when the device is in deep sleep,
@@ -290,7 +290,8 @@ class RadioService : MediaBrowserServiceCompat() {
290 290
         apiTicker.cancel() // stops the timer.
291 291
         Log.d(tag, radioTag + "destroyed")
292 292
         // if the service is destroyed, the application had become useless.
293
-        exitProcess(0)
293
+        // exitProcess(0)
294
+        Process.killProcess(Process.myPid())
294 295
     }
295 296
 
296 297
     // ########################################
@@ -360,7 +361,7 @@ class RadioService : MediaBrowserServiceCompat() {
360 361
                     Log.d(tag, radioTag + "onMetadata: IcyHeaders $entry")
361 362
                 }
362 363
                 if (entry is IcyInfo) {
363
-                    Log.e(tag, radioTag + "onMetadata: Title ----> ${entry.title}")
364
+                    Log.d(tag, radioTag + "onMetadata: Title ----> ${entry.title}")
364 365
                     // Note : Kotlin supports UTF-8 by default.
365 366
                     numberOfSongs++
366 367
                     val data = entry.title!!