diff --git a/app/build.gradle b/app/build.gradle index 51706e7..e987426 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "pasta.streamer" minSdkVersion 16 targetSdkVersion 23 - versionCode 3 - versionName "1.2" + versionCode 4 + versionName "1.3" renderscriptTargetApi 19 renderscriptSupportModeEnabled true vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/pasta/streamer/PlayerService.java b/app/src/main/java/pasta/streamer/PlayerService.java index d3e8377..adc6b63 100644 --- a/app/src/main/java/pasta/streamer/PlayerService.java +++ b/app/src/main/java/pasta/streamer/PlayerService.java @@ -155,14 +155,11 @@ public void onConnectionMessage(String s) { private void onError(String message) { if (spotifyPlayer != null) { errorCount++; - if (errorCount < 5) { - if (spotifyPlayer.isShutdown()) { - Toast.makeText(getApplicationContext(), message + ", please restart the app.", Toast.LENGTH_SHORT).show(); - } else { - Toast.makeText(getApplicationContext(), message + ", attempting to restart...", Toast.LENGTH_SHORT).show(); - stopService(new Intent(this, PlayerService.class)); - startService(new Intent(this, PlayerService.class)); - } + if (errorCount > 5 && errorCount < 20) { + Toast.makeText(getApplicationContext(), message + ", attempting to restart...", Toast.LENGTH_SHORT).show(); + stopService(new Intent(this, PlayerService.class)); + startService(new Intent(this, PlayerService.class)); + errorCount = 20; } else Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show(); } }