Use below code snippet And add
"android.permission.WAKE_LOCK"
in app manifestPowerManager powermgr = (PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wakelock = powermgr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "My Tag");
wakelock.acquire();
// call long running task
...
..
wakelock.release();
Unlock keypad: Required when using intents. example: Making a phone call with user activity and after completing phone call user acitivity shall not be held with a keylock
Use below code snippet inside Onresume() method of the activity. And add
"android.permission.DISABLE_KEYGUARD"
in app manifest public void checkKeypadLock()
{
KeyguardManager Keylockmgr = (KeyguardManager)getSystemService(KEYGUARD_SERVICE);
Keylockmgr.newKeyguardLock("My Tag").disableKeyguard();
}
Complete Usage of Disabling and Reenabling keyguard on Android
if (mKeyguardManager == null) {
mKeyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
mKeyguardLock1 = mKeyguardManager.newKeyguardLock("QApp");
mKeyguardEnabled = true;
}
PowerManager powermgr = (PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wakelock = powermgr.newWakeLock(PowerManager.FULL_WAKE_LOCK| PowerManager.ON_AFTER_RELEASE| PowerManager.ACQUIRE_CAUSES_WAKEUP,"QApp");
wakelock.acquire();
if (mKeyguardEnabled) {
mKeyguardLock1.disableKeyguard();//
if(mProductID == 1)
retval = mCalculator.Calc(mcalcJob,isOnline);
else if(mProductID == 2)
retval = m_pCalculator.Calc(mcalcJob,isOnline);
mprogressDialog.dismiss();
mHandler.post(updateResults);
// ON sony ericsson the keylock is very quick, so we wait for 3Sec before reenabling keyguard only on Xperia 10i
if(Build.MANUFACTURER.startsWith("Sony"))
{
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
wakelock.release();
mKeyguardLock1.reenableKeyguard();
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteInspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you..Keep update more information..
ReplyDeleterpa training in Chennai | best rpa training in chennai
rpa training in pune
rpa online training | rpa training in bangalore
It's interesting that many of the bloggers to helped clarify a few things for me as well as giving.Most of ideas can be nice content.The people to give them a good shake to get your point and across the command
ReplyDeleteData Science training in rajaji nagar | Data Science with Python training in chenni
Data Science training in electronic city | Data Science training in USA
Data science training in pune | Data science training in kalyan nagar
Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
ReplyDeleteDevops training in sholinganallur
Devops training in velachery
Devops training in annanagar
Devops training in tambaram
When I initially commented, I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several emails with the same comment. Is there any way you can remove people from that service? Thanks.
ReplyDeleteAmazon Web Services Interview Questions And Answers | Best AWS interview questions 2018
Advanced Amazon Web Services Training in Chennai | Best AWS Training Institute in Chennai
Advanced AWS Training Institute in Pune | Best AWS Training Center in Pune
Best AWS Training Institute in Marathahalli | Advanced AWS Training in Marathahalli, Bangalore
I recently came across your blog and have been reading along. I thought I would leave my first comment.
ReplyDeleteapple service center chennai | ipod service center in chennai | apple iphone service center in chennai | apple service center chennai
It is very good and very informative. There is a useful information in it.Thanks for posting...
ReplyDeletehttps://www.apponix.com/
good to read
ReplyDeleteinplant training in chennai
inplant training in chennai for it
panama web hosting
syria hosting
services hosting
afghanistan shared web hosting
andorra web hosting
belarus web hosting
brunei darussalam hosting
inplant training in chennai
good post...!
ReplyDeleteinternship in chennai for ece students
internships in chennai for cse students 2019
Inplant training in chennai
internship for eee students
free internship in chennai
eee internship in chennai
internship for ece students in chennai
inplant training in bangalore for cse
inplant training in bangalore
ccna training in chennai
This is such a great post, and was thinking much the same myself. Another great update.
ReplyDeleteJava training in chennai | Java training in bangalore | Java training in hyderabad | Java training in coimbatore | Java training in online
Thanks for this wonderful blog,it was very useful to enhance my knowledge.This is what i exacty needed and totally enjoying this blog,I really appreciate everything that you do.amazon web services aws training in chennai
ReplyDeletemicrosoft azure training in chennai
workday training in chennai
android-training-in chennai
ios training in chennai
Smm panel
ReplyDeletesmm panel
İs ilanlari
İnstagram Takipçi Satın Al
hirdavatciburada.com
WWW.BEYAZESYATEKNİKSERVİSİ.COM.TR
servis
tiktok jeton hilesi