Back to project page AndroidFortunes.
The source code is released under:
Apache License
If you think the Android project AndroidFortunes listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.codechimp.androidfortunes; /* w w w. j av a 2 s . c om*/ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; import android.util.Log; import org.codechimp.util.WakeLock; public class AlarmReceiver extends BroadcastReceiver { private static final String TAG = "AlarmReceiver"; private Context context; @Override public void onReceive(Context context, Intent intent) { Log.i(TAG, "Alarm Received"); this.context = context; WakeLock.acquire(context); new GetRandomQuoteTask().execute(); } private class GetRandomQuoteTask extends AsyncTask<Void, Void, Quote> { @Override protected Quote doInBackground(Void... params) { Quote q; q = CloudyFortunesClient.getCloudyFortunesApiClient().randomQuote(); return q; } @Override protected void onPostExecute(Quote result) { if (result != null) NotifyHelper.notify(context, result.getContent()); WakeLock.release(); } } }