Adb shell command to change the device language? [duplicate] - android

This question already has answers here:
Change Device language via ADB
(14 answers)
Closed 7 years ago.
I'm new in android automation and i've been working on adb commands to help me with tests on a physical device.
Is there a way to change the language of the device under test via adb?
I found the command below:
adb shell am start -n com.android.settings/.Settings -e :android:show_fragment com.android.settings.LocalePicker
Not worked. I also tried via shell with:
adb shell setprop persist.sys.language pt
But it didn't worked too.

I use the following to open locale settings in one of my applications:
final Intent intent = new Intent(Settings.ACTION_LOCALE_SETTINGS);
context.startActivity(intent);
The ACTION_LOCALE_SETTINGS constant is defined as follows:
public static final String ACTION_LOCALE_SETTINGS = "android.settings.LOCALE_SETTINGS";
So this should work:
adb shell am start -a android.settings.LOCALE_SETTINGS

Related

adb: inaccessible or not found [duplicate]

This question already has answers here:
/system/bin/sh: adb: not found
(2 answers)
Closed 1 year ago.
I have connected to my android tablet from PC and can confirm the results by running adb devices.
Chrome has been installed on Android's homescreen.
However, I met the error below when I ran
Patio730:/ $ adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
/system/bin/sh: adb: inaccessible or not found
You have entered inside your device shell and adb is not installed on the device.
Run the command without adb shell prefix, just like this:
am start -n <...>
Or you can do exit and then type the original command:
exit
adb shell am start -n <...>

Get/set imei number with adb for android phones [duplicate]

This question already has answers here:
adb shell dumpsys iphonesubinfo not working since Android 5.0 Lollipop
(4 answers)
Closed 7 years ago.
I want to get/set an imei number for rooted android phone.
I tried this command
adb shell dumpsys iphonesubinfo
I tried this command also
adb shell getprop gsm.baseband.imei
I tried this command also
service call iphonesubinfo 1
You can't set the IMEI, of any of the forms.
For getting it via ADB, see this question

Get Android OS version of device connected via ADB [duplicate]

This question already has answers here:
Android ADB commands to get the device properties
(4 answers)
Closed 7 years ago.
Can one use adb or adb shell commands to get attached emulator/device OS info, i.e. API version?
To get Android version you can use:
adb shell getprop ro.build.version.release
to get API level:
adb shell getprop ro.build.version.sdk
You can see all available properties with this command:
adb shell getprop
I know , you already got the correct solution , & here is my solution only for additional information.
You will get every details by cat ing the /system/build.prop file like
adb shell cat /system/build.prop
Here is collection of adb commands
For all properties:
adb shell getprop

Unable to run 'adb root' on a rooted Android phone [duplicate]

This question already has answers here:
adb shell su works but adb root does not
(11 answers)
Closed 5 years ago.
After rooting my device, I need to run adb root and then adb shell so I could then access my applications database. When trying to run adb root I keep getting "adbd cannot run as root in production builds". Why is this? The only other option is to use the Android emulator for testing, but we all know how terrible the emulator is (not really a viable development solution).
I finally found out how to do this! Basically you need to run adb shell first and then while you're in the shell run su, which will switch the shell to run as root!
$: adb shell
$: su
The one problem I still have is that sqlite3 is not installed so the command is not recognized.

Using ADB command know the name of application focussed using adb [duplicate]

This question already has answers here:
ADB - Android - Getting the name of the current activity
(13 answers)
Closed 4 years ago.
I am using the
adb shell input keyevent KEYCODE_DPAD_LEFT
to focus on an application, now i want to know the name of the application on which this has focussed using adb shell command.
NOTE: not exactly the name of application, it can focus on anything. SO i want to get the Text on which it focusses.
Ok. To do it, you need to use grep terminal application on your phone (the easiest way with rooted phone with busybox package). Let do the same steps as below:
C:\Users\Hasan>adb shell input keyevent KEYCODE_DPAD_LEFT
C:\Users\Hasan>adb shell
shell#android:/ $ su
su
root#android:/ # dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'
dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'
mCurrentFocus=Window{42079c60 com.jrummy.liberty.toolboxpro/com.jrummy.apps.rom.toolbox.RomToolboxActivity paused=false}
mFocusedApp=AppWindowToken{4283d918 token=Token{426709a8 ActivityRecord{41e37c60 com.jrummy.liberty.toolboxpro/com.jrummy.apps.rom.toolbox.RomToolboxActivity}}}
root#android:/ #
Now you'll see which activity has focus :)
You can use:
adb shell uiautomator dump /dev/tty
You will get an XML describing the current screen, one of the many <node>-elements will have an attribute focused="true". It may also have a text-attribute and a lot more UI-informations.

Categories

Resources