Dilip
Dilip

Reputation: 1162

Is there a delay in calling home screen intent?

I'm implementing an application locker for android. I have the following code in my onPause() of authentication activity where user has to enter his password.

@Override
protected void onPause() {
        super.onPause();
        blnSwitchingActivity = true;
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME)
                .addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
                .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
                .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
        startActivity(intent);
        finish();
}

The following scenario creates a problem.

  1. The user first clicks on any app.
  2. The authentication activity is opened. The user can either enter his password or go back.
  3. If he goes back, in onPause i'm calling home screen intent.
  4. The problem is when the user clicks on home screen, he has to wait for a few seconds to open any other app.

My question: Why there is a delay in calling the home screen intent?

Upvotes: 0

Views: 198

Answers (1)

NasaGeek
NasaGeek

Reputation: 2198

I'm not 100% sure of what your question is, but it sounds like some combination of android:noHistory=true and android:excludeFromRecents=true for the Activity in your manifest would do the trick for you.

Upvotes: 1

Related Questions