Start APP after boot completed

January 7, 2013   ·   0 Comments

This note is intended to get you going with the task in the subject in 5-10 minutes depending on your reading and typing speed. It applies to Android 1.5 (Cupcake).

Add this permission to AndroidManifest.xml:

And a receiver element to the manifest:






Create StartupBroadcastRecevier class similar to the following:

// replace with your package name
package com.burnayev.actioncomplete.android;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.burnayev.actioncomplete.android.activity.Main;

public class StartupBroadcastReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
Intent startupIntent = new Intent(context, Main.class); // substitute with your launcher class
startupIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(startupIntent);
}

}

You are done.

To test that your application starts up on boot you have to:
Run the application from Eclipse so that it gets installed on your phone.
Reboot your device (turn it off then turn it on). When phone starts up you should see your application started after a delay.
Enjoy.

shareShare on FacebookShare on Google+Share on LinkedInEmail this to someonePrint this pageBuffer this pageDigg thisFlattr the authorShare on RedditPin on PinterestShare on StumbleUponShare on TumblrTweet about this on Twitter

By


Readers Comments (0)


You must be logged in to post a comment.

PowenKo’s Online Store

powenko_arduinoBook
Android7

Amazon

adsbygoogle

Recent Posts

Categories

Amazon