Check for the Screen timeout or not!
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
if(pm.isScreenOn())
{
Toast.makeText(this,"Screen is not locked", 20).show();
}else
Toast.makeText(this,"Screen is time out", 20).show();
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
if(pm.isScreenOn())
{
Toast.makeText(this,"Screen is not locked", 20).show();
}else
Toast.makeText(this,"Screen is time out", 20).show();
No comments:
Post a Comment