I need to show some information in the Dialog
or something same via IntentService
. This dialog should be shown at the locked screen and wake up the phone if it has been locked. If it's possible and how can I do something like in WhatsApp application when message incoming?
Asked
Active
Viewed 571 times
0

Alexander Goncharenko
- 954
- 6
- 16
-
What does whatsapp do...? – r2DoesInc Aug 14 '14 at 18:53
-
When U have incoming message and your screen is locked it shows custom view with vibrate and sound. – Alexander Goncharenko Aug 14 '14 at 19:09
-
if the screen is not locked with a password, it is possible to "unlock" the lockscreen. Otherwise there is nothing you can do. – r2DoesInc Aug 14 '14 at 19:10
1 Answers
0
This is only possible if the device is not locked by a password. This may also require device admin permissions.
The following code will unlock the device and allow you to display whatever you wish.
KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Service.KEYGUARD_SERVICE);
KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
lock.disableKeyguard();

r2DoesInc
- 3,759
- 3
- 29
- 60
-
I dont want to disable screen lock. I know how to do that, I was asked how to show alert dialog when wake up, or go dirrectly to the application activity when IntentService works. I am new in android and asking more experienced developers to help me with this task. – Alexander Goncharenko Aug 14 '14 at 20:56
-
Once you disable the lockscreen you can do whatever you wish. Showing an alertdialog is as simple as just showing thr dialog. Nothing dofferent from that point on than if you were just in your app. – r2DoesInc Aug 14 '14 at 20:57
-
How can I show something on home screen after unlock my device? Is it doing with WindowManager or something? – Alexander Goncharenko Aug 14 '14 at 20:59
-
No. Start an activity and just show it. You may be overthinking this a bit. – r2DoesInc Aug 14 '14 at 20:59
-
what is disable keyguard when i am use in class creating a error this line lock.disableKeyguard(); – Ashish Shahi Apr 18 '17 at 06:15