Android via Commandline

Settings

list all system settings:

settings list system

list all secure settings:

settings list secure

list global (all) settings:

settings list global

Get system param setting (e.g. screen_brightness):

settings get system screen_brightness

Set System Param Setting:

settings put system Param Value

Set Display Timeout (60sec)

settings put system screen_off_timeout 60000

Set Display Brightness 0-255

settings put system screen_brightness 100 /* Non-Linear !!!! */

Navbar

If Navar should not be shown, please set property in /oem/init.oem.rc:

setprop qemu.hw.mainkeys 1

or configure Navbar keys during runtime:

e.g. keys recent home back

settings put secure sysui_nav_bar "recent;home;back,space,space"

keys only back

settings put secure sysui_nav_bar "space;back;space"

or No keys active:

settings put secure sysui_nav_bar "space;space;space;space;space"

Set custom Navbar with own Icons

settings put secure sysui_nav_bar "space,key(4:file:///storage/emulated/0/NavIcons/back.png);key(3:file:///storage/emulated/0/NavIcons/home.png);key(187:file:///storage/emulated/0/NavIcons/recents.png),space"

Enable/Disable ADB Debug connection

settings put global adb_enabled 1 /* (1=on) (0=off) */

Set Language/Region (FR)

https://developer.android.com/guide/topics/resources/multilingual-support

Call Settings Applet:

am start -a android.settings.LOCALE_SETTINGS

These following calls are recommended only, if only one Language ist selected in the settings Menu

Deutsch/DE

setprop persist.sys.locale de-DE settings put secure enabled_input_methods com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME setprop ctl.restart zygote

Englisch/US

setprop persist.sys.locale en-US settings put secure enabled_input_methods com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME setprop ctl.restart zygote

Englisch/Great Britain

setprop persist.sys.locale en-GB settings put secure enabled_input_methods com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME setprop ctl.restart zygote

Französisch

setprop persist.sys.locale fr-CA settings put secure enabled_input_methods com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME setprop ctl.restart zygote

Spanisch

setprop persist.sys.locale es-ES settings put secure enabled_input_methods com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME setprop ctl.restart zygote

Italienisch/Italien

setprop persist.sys.locale it-IT settings put secure enabled_input_methods com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME setprop ctl.restart zygote

Nederlands/Holland

setprop persist.sys.locale nl-NL settings put secure enabled_input_methods com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME setprop ctl.restart zygote

Tschechisch

setprop persist.sys.locale cs-CZ settings put secure enabled_input_methods com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME setprop ctl.restart zygote

Clear actual input method

settings put secure enabled_input_methods com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME

Set Pincode

locksettings set-pattern --old 0815 1234 Pattern set to '1234'

Get/Set Timezone

Automatic Setting:

settings put global auto_time 1 am broadcast -a android.intent.action.TIMEZONE_CHANGED

Get Timezone:

settings get global time_zone

Set Timezone (Berlin):

settings put global time_zone Europe/Berlin am broadcast -a android.intent.action.TIMEZONE_CHANGED

Set Timezone with Property instead settings

setprop persist.sys.timezone "America/Chicago" am broadcast -a android.intent.action.TIMEZONE_CHANGED

Set Date Time

With busybox:

date -s [YYYY.]MM.DD-hh:mm[:ss]

For: Thu Nov 12 19:44:00 GMT 2020

busybox date -s 2020.11.12-19:44 am broadcast -a android.intent.action.TIME_SET

Note:for telnet connection, busybox is used and busybox call can be removed

Or with /system/bin/sh:

date "MMDDhhmm[[CC]YY][.ss]" SET

For: Nov 12 2020 18:49 <

/system/bin/sh date 1112184920 SET am broadcast -a android.intent.action.TIME_SET

Note:for adb or console /system/bin/sh is used and /system/bin/sh call can be removed

Read Build Date

grep "ro.build.date" /system/build.prop

or

getprop ro.build.date

Grant Permissions

Example for Package com.user.package:

grant WRITE_SECURE_SETTINGS
grant CHANGE_CONFIGURATION

pm grant com.user.package android.permission.WRITE_SECURE_SETTINGS pm grant com.user.package android.permission.CHANGE_CONFIGURATION