I am doing one application using proximity sensor in android. when sensor changed it should lock the phone and when phone is locked using same sensor it should unlock a phon
When phone is locked your application gets into standby mode so code writen do no work. You need keep your app open to make it work when phone is locked.for this you need to take granted permission from user and change phone settings before executing this code.