0

I'm trying to make my application auto-start when phone starts and I'm using this code:

public class BootUpReceiver extends BroadcastReceiver{

    @Override
    public void onReceive(Context context, Intent intent) {
            Log.i("DEBUG", "BootUpReceiver.onReceive INICIO");
            Log.i("DEBUG", "BootUpReceiver.onReceive INICIO");
            Intent i = new Intent(context, AppPradoActivity.class);
            Log.i("DEBUG", "BootUpReceiver.onReceive 1");
            i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(i); 
            Log.i("DEBUG", "BootUpReceiver.onReceive 2");
            Log.i("DEBUG", "BootUpReceiver.onReceive FINAL");
    }

}

If I'm using the phone while the app is starting, it doesn't appears on top. It starts in the foreground.

Is there any solution for this issue?

Thanks in advance.

lucian.pantelimon
  • 3,673
  • 4
  • 29
  • 46
Joterito
  • 153
  • 2
  • 15

1 Answers1

0

I don't really understand your question but maybe you're using the wrong FLAG ?

You could try to add some additional flags:

FLAG_ACTIVITY_CLEAR_TOP

FLAG_ACTIVITY_REORDER_TO_FRONT

FLAG_ACTIVITY_SINGLE_TOP