I'm trying to detect the unlock of the phone with the app in background.
I'm registering a receiver with registerReceiver method to detect the unlock of the phone, and apparently it only works as long as the context used is alive so I used the application context :
getApplicationContext().registerReceiver(receiver, filter);
I want to know how long I can expect this receiver to work when the user leave my application and does not use it (so when is the application context killed).
I firstly wanted to use the ACTION_USER_PRESENT in the manifest but this need for read_phone_state permission (and it would be difficult to explain to the user why the app need to make calls...).