Created
October 28, 2014 13:39
-
-
Save moea/2537eb68fe3db174e5be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package me.ambient.cachehours; | |
import android.app.IntentService; | |
import android.content.Intent; | |
import android.content.Context; | |
import android.support.v4.content.LocalBroadcastManager; | |
public class MyIntentService extends IntentService { | |
public MyIntentService() { | |
super("MyIntentService"); | |
} | |
@Override | |
protected void onHandleIntent(Intent intent) { | |
if (intent != null && "do the doge".equals(intent.getAction())) { | |
doTheDoge(); | |
} | |
} | |
protected void doTheDoge() { | |
// do the doge for a while | |
try { | |
Thread.sleep(15 * 1000); | |
} catch (InterruptedException e) { | |
e.printStackTrace(); | |
} | |
LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("did the doge")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment