JustiN diary

A simple “Lock Screen” application

This post will show you how to do it in the simplest way.
Let’s create a new project and start coding for now!
Step 1: Main activity:

Step 2: Create a receiver:

Step 3: this is about android-manifest, read all the lines carefully:

Step 4: Now try to create the “xml” folder in res, add new xml file named “device_admin.xml” with following lines:

Done!

Now run & install it on your physical device, go to phone’s Settings -> LockScreen and security -> Other security settings -> Device administrator -> activate your new lock screen app to allow it control the phone’s locking activity. these steps will look like following on my phone (android 7.0). Try to find it on your phone (It might different)

Tap the app icon on home screen and now it’s working fine.