0

I'm creating an application that uses alarms.

That's how I start alarm activity (in broadcast receiver)

    Intent myIntent = new Intent(context, AlarmActivity.class);
    myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
            | Intent.FLAG_ACTIVITY_CLEAR_TASK
            | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    context.startActivity(myIntent);

When alarm activity is closed, and the application is started again from home button, this activity is launched each time instead of my splash screen, and I have to remove last launched apps from recent apps menu, only then the splash screen is started when the application is launched.

By the way, the above flags are needed to unlock the screen if locked when the alarm is fired, and I have this in my alarm activity:

@Override
public void onAttachedToWindow() {
    this.getWindow().setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN
                    | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
                    | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
                    | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON,
            WindowManager.LayoutParams.FLAG_FULLSCREEN
                    | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
                    | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
                    | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
}

Any one has an idea?

Hamzeh Soboh
  • 7,572
  • 5
  • 43
  • 54

0 Answers0