androidsecuritysettingslockscreen

How to change the Lock screen custom text(Owner Info)?


I wrote the program code

String message = "This is test";
            Settings.System.putString(context.getContentResolver(),
                    Settings.Secure.LOCK_PATTERN_ENABLED, message);

This is not changing the lock screen text(Owner Info) and Added permission as

<uses-permission android:name="android.permission.WRITE_SETTINGS" />

Solution

  • Change Settings.Secure.LOCK_PATTERN_ENABLED to Settings.System.NEXT_ALARM_FORMATTED.

    Note that Settings.System.NEXT_ALARM_FORMATTED was deprecated in API level 21. You must use getNextAlarmClock() instead. getNextAlarmClock() is a public method in AlarmManager class which was introduced in API level 21. You need to install API level 21 in order to use this method. Also, make necessary changes in Android Project Build Target.