Creating Custom Lockscreen in Android

Create custom LockScreen for Android

At the end I managed to make this app working. My biggest problem was to put my device in kiosk mode (disabling hardware buttons when the lockscreen is displayed). The solution that worked for me was enabling device owner mode using Android Debug Bridge. It wasn't the best solution, but it was the most acceptable one for this project.

Here are some of the links that I used to achieve this:

https://documentation.meraki.com/SM/Device_Enrollment/Enabling_Device_Owner_Mode_using_Android_Debug_Bridge_(ADB)

http://www.sureshjoshi.com/mobile/android-kiosk-mode-without-root/

Developing a custom lock screen

There is no support for creating a "custom lock screen aap" in the Android SDK. You can only modify the lock screen behavior in custom firmware.

UPDATE

Note that Android 4.2 does allow you to create app widgets that can be added to the device's lockscreen, which may meet your needs.

Provide custom lock screen method

It's not possible unless you create your own custom lock screen. You can build one pretty easily though with the Adenda SDK. Sign up for it on their website, they usually respond pretty quickly

Create custom lockscreen for android 4.0 or above?

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

How to create a custom lock screen widget (I just want to display a button)

API Levels

Lock-screen widgets were introduced in API 17 (4.2), and removed in API 21 (5.0). They are not supported on other official releases.


Basic Widget

I wrote a simple widget as a demo tutorial - it contains all the boilerplate code required for a widget, and very little else:

  • WiFi Widget Demo (github)
  • WiFi Widget (Play store)

I wrote it in such a way to make it easy for anyone to remove the "wifi" related code, and adapt it to their own widget requirements. It might be perfect for you to look at, and relatively simple to add a single button to it.


Lock-screen / Keyguard Widget

There are 2 changes to make it work as a lock-screen widget:

  • updating the widgetCategory to include keyguard
  • adding an initialKeyguardLayout

These changes are done in the ./res/xml/widget_info.xml file, as seen below:

<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:initialKeyguardLayout="@layout/widget"
android:initialLayout="@layout/widget"
android:minHeight="40dp"
android:minWidth="250dp"
android:updatePeriodMillis="0"
android:widgetCategory="home_screen|keyguard" >
</appwidget-provider>

I do not know if it is possible to integrate the camera into your own lock-screen widget. Clicking on a lock-screen widget normally requires the user to unlock the device before the click works.



Related Topics



Leave a reply



Submit