Full Screen PIN request

70 Views Asked by At

I'd like to show a full screen PIN request (e.g. a dedicated activity) when my Application is resumed. How can I achieve this? I'm thinking about creating a flag ASKING_PIN on Application context, specifically on Application resume lifecycle, then sending an event to all activities. The first one that catch that event, update the flag to TRUE and show the PIN request.

@Override
public void onActivityResumed(Activity activity) {
    // POST PIN event on EventBus
}

Will this work as expected? Any other possible solutions? Important note: when the user dismiss the PIN activity should be able to see the latest activity that was interacting with. Many thanks in advance.

1

There are 1 best solutions below

2
On BEST ANSWER

Create one BaseActivity, and have every other activity inherit from that one. On the BaseActivity's onResume add your condition for launching the PIN lock, and if that's satisfied, launch your PinLockActivity.