Android Question How to check every time the app is on top

Alberto Michelis

Well-Known Member
Licensed User
Longtime User
Hi, I have an app that cheks for Fingerprint on a 'not main' activity, the activity which has the app menu.
I am cheking for fingerprint in Create, it works ok but I need to check again when the user change to another app and goes back to my app.
Ive try in Pause and in Resume but because its a main menu activity it always ask for fingerprint even if the user does not goes to another app.
How to do it?
 

Alberto Michelis

Well-Known Member
Licensed User
Longtime User
Ive tried, as I said...
Problem is that in Resume the check appears even when another Actovity comes back to the menu.
 
Last edited:
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
If I understand correctly, the fingerprint is asked every time.

It will be sufficient to set a boolean variable at Activity level (Sub Globals) and avoid to execute the code that asks for the fingerprint if this variable has already been set to True (i.e. operation already performed).
 
Upvote 0

Alberto Michelis

Well-Known Member
Licensed User
Longtime User
FWIW, what Ive donde is:
Global Variable "ImBack" in Main.
Each time another activity press the back key I set this variable to datetime.now
In Resume of the menu activity I check if datetime.now-ImBack is grater than 1000
If its then check biometrics
Thanks
 
Upvote 0
Top