aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-02-18 16:20:04 -0800
committerScott Jackson <daneren2005@gmail.com>2014-02-18 16:20:04 -0800
commitf610c117dcb613dc8407f4df3921de2b16a998ab (patch)
tree3504c2cb804ea09fdcf88825e8901e0ce2b649cb /src/github
parent2e2964235d96f85ba12ac3a87a233ae21bedb13d (diff)
downloaddsub-f610c117dcb613dc8407f4df3921de2b16a998ab.tar.gz
dsub-f610c117dcb613dc8407f4df3921de2b16a998ab.tar.bz2
dsub-f610c117dcb613dc8407f4df3921de2b16a998ab.zip
#167 Convert scrobbler to use BackgroundTask
Diffstat (limited to 'src/github')
-rw-r--r--src/github/daneren2005/dsub/service/Scrobbler.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/github/daneren2005/dsub/service/Scrobbler.java b/src/github/daneren2005/dsub/service/Scrobbler.java
index a9a5bb67..cdf00133 100644
--- a/src/github/daneren2005/dsub/service/Scrobbler.java
+++ b/src/github/daneren2005/dsub/service/Scrobbler.java
@@ -4,6 +4,7 @@ import android.content.Context;
import android.util.Log;
import github.daneren2005.dsub.domain.PodcastEpisode;
+import github.daneren2005.dsub.util.SilentBackgroundTask;
import github.daneren2005.dsub.util.Util;
/**
@@ -45,9 +46,9 @@ public class Scrobbler {
lastNowPlaying = id;
}
- new Thread("Scrobble " + song) {
+ new SilentBackgroundTask(context)<Void> {
@Override
- public void run() {
+ protected Void doInBackground() {
MusicService service = MusicServiceFactory.getMusicService(context);
try {
service.scrobble(id, submission, context, null);
@@ -55,7 +56,8 @@ public class Scrobbler {
} catch (Exception x) {
Log.i(TAG, "Failed to scrobble'" + (submission ? "submission" : "now playing") + "' for " + song, x);
}
+ return null;
}
- }.start();
+ }.execute();
}
}