I want to change the timezone using adb shell command.
I went through some posts which allow changing it in linux, but they are not valid for android.
For the list of tzdata values I go to http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
To set the timezone use setprop persist.sys.timezone <TZ> command:
setprop persist.sys.timezone "America/Chicago"
adb shell service call alarm 3 s16 America/Phoenix, which will be effective immediately.
"setprop with persist.sys.timezone" only works after reboot.
adb shell service call alarm 4 s16 America/Chicago
4 - stands for the fourth function in alarm service implementation.
s16 - stands for string argument type.
https://android.stackexchange.com/questions/34625/where-to-find-description-of-all-system-bin-service-calls
In my (very) limited experience I have been able to edit the /system/build.prop file. I change the line in there that says persist.sys.timezone=America/Sao_Pao or some such drival to persist.sys.timezone=America/Chicago for my timezone CDT. I also changed the lines persist.sys.language=bt and persist.sys.country=AR to persist.sys.language=en and persist.sys.country=US respectively.
There are a few other things you can tweak in the file that will persist after a system restore. You might want to make sure that the build.prop file in a flash image or directory has the correct lines in it.
The /system/property directory seems to hold several text files with a single value. These seem to show up after using setprop but the OS doesn't seem to reflect the changes.
Editing these files usually does require root access either with a term program or the ADB.exe shell. (ADB = Android Device Bridge available in the Android SDK) I found ADB.exe while looking through the firmware downloads at JXD.HK for the S18 MiniPad. In the files.rar dl there is also the SuperUser.apk and a rooted version of busybox and su.
Best of Luck !!!
Please see this https://gist.github.com/jpkrause/6b7e576894a800d451bf for answer to your question.
So in your case it would be:
adb shell setprop persist.sys.timezone America/Chicago
This works with ADB
Get current global time zone:
adb shell settings get global time_zone
Set a time zone:
adb shell settings put global time_zone Europe/Madrid
Time zones list:
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
I changed 2 files to change my timezone.
the one that i don't entire know if it's necessary, but it keeps things in sync:
/etc/timezone
the more one you for sure need to change:
/etc/localtime
from http://www.cyberciti.biz/faq/linux-unix-set-tz-environment-variable/ you can determine the name of the timezone you want with tzselect.
I took inspiration from http://www.cyberciti.biz/faq/howto-set-date-and-time-timezone-in-freebsd/
and copied my timezone file from /usr/share/zoneinfo/ to /etc/localtime.
/etc/timezone is a text file with the name of the timezone. so i just updated it to match the value provided by tzselect.
Related
When I watch android source code, I found
adb shell setprop log.tag.CAM2PORT_ VERBOSE
This can output log in logcat. I want to know how to make all log tag output even if it is verbose.
I have tried
adb shell setprop log.tag.* VERBOSE #It's not work
Thanks for your help
You must set every tag you want to log. Regex like log.tag.* won't work.
Like you said, not optimal if you are using different tags in your app.
You can try to use the local.prop file and define all your tags, probably easier than using adb shell setprop for every tag every time you want to enable logging.
You can also create a local.prop file that with the following in it:
'log.tag.=' and place that in /data/local.prop.
https://developer.android.com/reference/android/util/Log.html#isLoggable(java.lang.String,%20int)
In order to set a global minimum log level there is no need to configure tags individually. Just run
adb shell setprop persist.log.tag V
to enable all logs with any tag. Any supported Android priority can be set, so also DEBUG, INFO and others. The names can be specified in full, but only the first character is relevant. You can find more details here: https://medium.com/#mike_87757/set-android-minimum-log-level-globally-for-all-tags-4b1cbc1dc71f
I am developing a security related app and would like to know when was the device previously factory reset? Is there any way to obtain this information?
I tried getting the last modified time for many files using the adb shell but some show 1970/1971/current date which is not consistent or accurate.
adb shell "stat /cache | grep Modify"
I know you said you tried getting modification time for some files, but the specific one you need to query is /cache.
The /cache folder is wiped when you factory reset your phone.
The command you would use is adb shell "stat /cache | grep Modify". Which produces something like: Modify: 2016-01-27 15:57:38.000000000
I am interested in running
adb shell setprop log.tag.Volley VERBOSE
at all times so i can see always see these debug messages inside logcat. Is there somewhere I can perm specify this? I don't want to open a command prompt every time to set this.
to make my comment clear and visible as answer:
using leading word persist. prior to your package should lead to a persistent property.
adb shell setprop persist.your.package.name VERBOSE
sources: question in this post and Mike Lockwoods first answer in this thread
i don't know, if this works with AVDs that are restarted and if it's wiped together with the wipe user data of the avd.
I set one of the program as default launcher program and default setting program so I cannot change the default programs now, can I change the default programs from android-sdk\android-sdk\platform-tools\adb.exe or remote shell.
How can I do that?
And can I remove the defaults of program in Java code?
For system apps you can't uninstall, use pm disable as in
adb shell pm disable com.android.launcher
you can remove (Uninstall) the default program you set using ADB by doing this :
adb uninstall app.package ..... //for example (com.example.homeapp)
If you don't want to remove the app .. here is a quick hack to do it:
adb shell
am start -a android.intent.action.MAIN
That way you will have a picker with all apps on your devices that listens to Main Action
Choose any home screen app you want . then go to settings and set it as default.
adb shell cmd package set-home-activity "package/activity"
adb reboot
The key is adb. Once you know the package name of the app you wish to clear data for, try:
adb shell pm clear package.name.of.app
It'll clear all data for the app, but I don't know of a way to only clear the defaults.
You can check and change the default sms app by using adb shell settings get secure sms_default_application and then use adb shell settings put secure sms_default_application <package name>. I'm not sure about the other default apps, but it's just a matter of finding it with adb shell settings list <secure/system/global>
I want to change 3G dns setting on Android 2.1 device. I managed to install busybox on my device, i can also get dns information by using adb shell getprop | grep dns. The only problem is that it shows me net.pdp0.dns1 and net.pdp0.dns2, not net.rmnet0.dns1 and net.rmnet0.dns1 so i can't change the setting.
I know that net.rmnet0.dns1 is for 3G connection, so what about net.pdp0.dns1? How can i change to net.rmnet0.dns1?
Thanks
Android DSN file contains in following directory:
In android file system
system/etc/dhcpcd/dhcpcd-hooks/20-dns.conf
20-dns.conf file contains dns setting, you can modify this file by following way:
# Set net.<iface>.dnsN properties that contain the
# DNS server addresses given by the DHCP server.
set_dns_props()
{
case "${new_domain_name_servers}" in
"") return 0;;
esac
count=1
for i in 1 2 3 4; do
setprop dhcp.${interface}.dns${i} ""
done
count=1
for dnsaddr in ${new_domain_name_servers}; do
setprop dhcp.${interface}.dns${count} ${dnsaddr}
count=$(($count + 1))
done
setprop dhcp.eth0.dns1 8.8.8.8
setprop dhcp.eth0.dns2 8.8.8.4
}
unset_dns_props()
{
for i in 1 2 3 4; do
setprop dhcp.${interface}.dns${i} ""
done
}
case "${reason}" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT) set_dns_props;;
EXPIRE|FAIL|IPV4LL|RELEASE|STOP) unset_dns_props;;
esac
(Note:Please take backup of origin file , if you need origin file)
set your dns in following line
setprop dhcp.eth0.dns1 8.8.8.8
setprop dhcp.eth0.dns2 8.8.8.4
It may help if you state the kind of device you have. From what I've read online, Samsung devices use the pdp0 interface names (it may be that this is the way Samsung refers to the 3G connections). Personally I have been using all HTC devices and the 3G interface is always rmnet0.
Is your phone rooted? You may not be able to set properties in the "net" category without root permissions.
If you are root, have you tried "setprop net.pdp0.dns1 "? Also, does "adb shell getprop | grep dns" give you "net.dns1"? I believe this is the default way Android looks up DNS servers. You may want to set this property as well.
You can test if it is working by running nslookup, it will show you the server it is querying.
Good luck,
B-Rad