I want to make an application which has auto start option in its settings. I have made Settings activity in my application which is derived from PreferenceActivity and give
I think from Android 3.1 onwards your BroadcastReceiver which receives BOOT_COMPLETED intent its not going to work. User have to in-wake the application by interacted with it.
So, After booting the device all third party application are lying as a stop.
And for currently your application you can use SharedPreferences for Auto-Start your application..
UPDATE: (Only for Android version below 3.1 for higher version it works but you have to user interaction with your application after boot completed on device)
You need to use a BroadcastReceiver with android.intent.action.BOOT_COMPLETED intent.
Add following to your manifest file:
App_Receiver class implementing BoradcastReciever. Implement the onReceive() method and start your favorite activity from your app.
public void onReceive(Context context, Intent intent) {
// make sure you receive "BOOT_COMPLETED"
// Here isAutoStartEnabled check sharedPreferences for Auto Start flag
if ( isAutoStartEnabled ) {
if ((intent.getAction() != null) && (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")))
{
// Start the service or activity
}
}