3

May i know how to detect when apps is awake from the background??

the flow is:

1) The application is open

2) User tap home button to go out and using other apps(without exit)

3) User tap recent apps button and choose back current application

4) prompt a message to ask user insert pin number

I had tried using onPause/onUserLeaveHint and onResume, but it won't work

@Override
protected void onPause() {
    super.onPause();
    sleep=true;
}
@Override
protected void onResume() {
    super.onResume();

    if(sleep) {
        if (!passcode) //no pin is set
        {
        }
        else if (passcode) //a pin is set
{ 
            Intent check_passcode = new Intent(this, CheckPasscode.class);
            check_passcode.putExtra("passcode_value", passcode_value);
            startActivity(check_passcode);
        }
        sleep = false;
    }
    else{

    }
}

the intent is prompt out every time i go to a new Activity by intent.

*I have many other activity call by intent.

enzo
  • 309
  • 3
  • 15
  • `"I had tried using onPause/onUserLeaveHint and onResume, but it won't work"` **onPause** doesn't work? how come? – pskink May 11 '15 at 05:43

0 Answers0