0

I have created app which is also a launcher. This app will load app by default on start up. I would like to give user an option to uncheck not run app on startup.

To load the app on start up I am using Boot receiver in manifest and calling the required java file to load the app.

Now How do I override startup if option is unchecked - instead of loading my app it should load the home screen?

Tried this:

  public class BootUpReceiver extends BroadcastReceiver 
  {
 String nostartup= "2";
 @Override
  public void onReceive(Context context, Intent intent) 
   {
    if (nostartup.equalsIgnoreCase("1"))
    {

    Intent i = new Intent(context, main.class);  
    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(i);  
    }
    else
    {

    }   
  }
  }

When I restart my tablet I get complete action using prompt gives out other launcher programs with home laucher

How do I go about choosing home launcher?

TheDevMan
  • 5,914
  • 12
  • 74
  • 144
  • duplicate question: http://stackoverflow.com/a/5625179/906362 – Budius Mar 07 '13 at 12:26
  • possible duplicate of [Enable and disable a Broadcast Receiver](http://stackoverflow.com/questions/5624470/enable-and-disable-a-broadcast-receiver) – Budius Mar 07 '13 at 12:26
  • "To load the app on start up I am using Boot receiver in manifest and calling the required java file to load the app" -- that will not be reliable, as you have no control over when your `BroadcastReceiver` gets control, and so the home screen might still appear on top. – CommonsWare Mar 07 '13 at 13:25
  • This setup works just fine. – TheDevMan Mar 08 '13 at 05:25

1 Answers1

0

In the receiver you should check the option.

if its enabled, start your app/activity. if not, just do nothing. and it should go to the homescreen.

Dodge
  • 8,047
  • 2
  • 30
  • 45