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.