Back to project page photogallery.
The source code is released under:
Apache License
If you think the Android project photogallery 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 com.donnemartin.android.photogallery; //from www. j ava 2 s .com import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.util.Log; public class StartupReceiver extends BroadcastReceiver { // When this BroadcastReceiver wakes up, it will call onReceive then die. // Because it is short lived, you cannot use async APIs or register any // listeners because the receiver will not be alive longer than the length // of onReceive. onReceive runs on the main thread, so no networking or // work with permanent storage. // BroadcastReceivers are useful for small plumbing code. private static final String TAG = "StartupReceiver"; @Override public void onReceive(Context context, Intent intent) { Log.i(TAG, "Received broadcast intent: " + intent.getAction()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); boolean isOn = prefs.getBoolean(PollService.PREF_IS_ALARM_ON, false); PollService.setServiceAlarm(context, isOn); } }