App for dealing with Android settings
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app Add altitude parameter to the location info output (#17) Sep 6, 2018
gradle/wrapper
.gitignore
.npmignore
.npmrc
LICENSE
README.md Add altitude parameter to the location info output (#17) Sep 6, 2018
build.gradle
build.xml
gradlew
gradlew.bat
index.js Update Appium Settings app to make it compatible with recent Android … Mar 23, 2017
package.json
settings.gradle

README.md

Settings

Toggle settings in Android device or emulator.

A small and simple Android application that deals with the system settings. Then the application shuts down.

Requirements

You may also consider using Android Studio to debug the code easily.

Building

$ ./gradlew clean assembleDebug

You can also run gradlew installDebug to build and immediately deploy the app to a connected Android device or emulator.

Installing

You can install the apk through the Android Debug Bridge.

To install:

$ cd app/build/outputs/apk
$ adb install settings_apk-debug.apk

To uninstall:

$ adb uninstall io.appium.settings

Changing of system settings

Once installed on a device, you can change the wifi, data, animation and locale settings through the following commands:

To turn on wifi:

$ adb shell am broadcast -a io.appium.settings.wifi --es setstatus enable

To turn off wifi:

$ adb shell am broadcast -a io.appium.settings.wifi --es setstatus disable

To turn on data:

$ adb shell am broadcast -a io.appium.settings.data_connection --es setstatus enable

To turn off data:

$ adb shell am broadcast -a io.appium.settings.data_connection --es setstatus disable

To turn on animation:

$ adb shell am broadcast -a io.appium.settings.animation --es setstatus enable

To turn off animation:

$ adb shell am broadcast -a io.appium.settings.animation --es setstatus disable

Set particular locale:

$ adb shell am broadcast -a io.appium.settings.locale --es lang ja --es country JP

You can set the Locale format, especially this feature support Locale(String language, String country) so far.

Retrieval of system settings

You can retrieve the current geo location by executing:

$ adb shell am broadcast -a io.appium.settings.location -n io.appium.settings/.receivers.LocationInfoReceiver

The first value in the returned data string is the current latitude, the second is the longitude and the last one is the altitude. An empty string is returned if the data cannot be retrieved (more details on the failure cause can be found in the logcat output).

Notes:

  • You have to specify the receiver class if app never executed before:
$ adb shell am broadcast -a io.appium.settings.wifi -n io.appium.settings/.receivers.WiFiConnectionSettingReceiver --es setstatus disable
  • To change animation setting, app should be granted SET_ANIMATION_SCALE permission:
$ adb shell pm grant io.appium.settings android.permission.SET_ANIMATION_SCALE
  • To change locale setting, app should be granted CHANGE_CONFIGURATION permission:
$ adb shell pm grant io.appium.settings android.permission.CHANGE_CONFIGURATION
  • On Android 6.0+ you must enable the corresponding permissions for the app first. This can be done in application settings, Permissions entry.

  • Switching mobile data on/off requires the phone to be rooted on Android 5.0+ ('su' binary is expected to be available on internal phone file system). Read this StackOveflow thread for more details.

Voila!

Caveats

There are certain system services which cannot be accessed through an application. Two ones central here are airplane_mode and gps.

License

Apache License 2.0