25

I want to create custom lockScreen for android 4.0 and above, I have tried widget to create lockscreen but it supports only android 4.2.

Is there any other way to create custom android lockScreen?

Aadil
  • 713
  • 2
  • 12
  • 30

1 Answers1

57

I have found snippets somewhere on internet few months ago, I have made changes and recently uploaded the working demo on my github account, You can have a look at this

Note: It will disable "hardware" home button.

I hope it will be helpfull !!

Screenshots:

It provides lockscreen in API 8 or above.

Initial

Alt text

Locked

Alt text

Unlocked

Alt text

Mehul Joisar
  • 15,348
  • 6
  • 48
  • 57
  • @Mehul Joisar +1 from me...i have used ur code..and it works perfectly but unfortunately it is not possible to do it for ICS and above....is that any other way...? – TheFlash Aug 14 '13 at 05:41
  • @Indiandroid:yes,there is no work around for ICS+. you can try to handle Home button click programmatically but it is not recommended. – Mehul Joisar Aug 14 '13 at 06:29
  • @Mehul Joisar u r right..so i can't make it...:( but what about the applications which r on play for example-https://play.google.com/store/apps/details?id=com.dronasys.productivity.free.launcher.p.launcher&hl=en – TheFlash Aug 14 '13 at 06:43
  • @Indiandroid: that is launcher application.we can create our custom launcher application like others,but we can't create just lockscreen application easily by excluding launcher. – Mehul Joisar Aug 14 '13 at 06:46
  • I wanted to point out that the application does not replace the default lock screen of Android (API level 18). When the screen is unlocked using this application, the phone displays the default lock screen. Any workaround that? – Bhoot Feb 07 '14 at 07:19
  • Yes Bhoot, you are right i am also using this code but i am not able to unlock the default screen. – Faraz Ahmed Feb 14 '14 at 15:47
  • @MehulJoisar i made an app and then integrated your lockscreen app into my app, its working fine but the problem is whenever i start the app it starts the lock screen. I want the app to be started whenever i start the app and the lock screen to be run in the background plus the android lock screen appears first and then my lock screen. Is there any solution to both the problems – Sagar Devanga Dec 02 '14 at 06:07
  • @SagarDevanga: Unfortunately, it won't work in your case as it relies upon `ACTION_SCREEN_ON` and `ACTION_SCREEN_OFF` flags only. – Mehul Joisar Dec 02 '14 at 06:45
  • @MehulJoisar which one of the two problems wont work Getting Different Screens for App and LOCKSCREEN or Placing the lockscreen before the android lockscreen – Sagar Devanga Dec 02 '14 at 06:51
  • one problem is solved using the below link, @MehulJoisar could you just help me out with the other one http://stackoverflow.com/questions/3629179/android-activity-over-default-lock-screen – Sagar Devanga Dec 02 '14 at 10:00
  • @MehulJoisar Thanks for your lock screen app code. Its easy to understand and helped a lot. But when i click on home button the lock screen is closed. Is there any way to keep the lock screen alive even after home button is pressed. You may take ZUI locker for example. Please help. Thanks in advance. – Redone Jun 25 '15 at 11:17
  • 1
    @Redone: checkout [this](https://github.com/shaobin0604/Android-HomeKey-Locker) if it can help you out. – Mehul Joisar Jun 25 '15 at 12:03
  • @MehulJoisar Thanks Mehul but its only for hardware buttons. – Redone Jun 26 '15 at 10:42
  • @Redone: Infact, It is anti-pattern and discouraged to disable home button. Whatever you solution you can find is nothing but the workaround. – Mehul Joisar Jun 26 '15 at 11:22
  • It only disables the home button while the app is up right? It doesn't totally take away the functionality? – EM-Creations Apr 06 '18 at 20:12