Advertisement
moonlightcheese

Untitled

Aug 30th, 2011
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. public class BootReceiver extends BroadcastReceiver {
  2.     final String LOG_TAG = "Minutemaid - BootReceiver";
  3.    
  4.     @Override
  5.     public void onReceive(Context context, Intent intent) {
  6.         String action = intent.getAction();
  7.         if (Intent.ACTION_BOOT_COMPLETED.equals(action)) {
  8.             //DO THINGS ON STARTUP (START THE SERVICE)
  9.             Log.i(LOG_TAG, "boot intent received");
  10.             context.startService(new Intent(context, MinutemaidService.class));
  11.         }
  12.     }
  13. }
  14.  
  15. <receiver android:name=".BootReceiver"
  16.         android:enabled="true"
  17.         android:exported="true">
  18.     <intent-filter>
  19.         <action android:name="android.intent.action.BOOT_COMPLETED" />
  20.     </intent-filter>
  21. </receiver>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement