Last active
March 3, 2019 15:38
-
-
Save simonpham/e6e75db7437c9269df7e1475827b8261 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Step 1: Set up Devetter on the phone (with WRITE_SECURE_SETTINGS permission approved) | |
// Step 2: Declare some constants | |
// <ACTION TYPE> | |
const val ACTION_PUT_GLOBAL = "com.github.simonpham.devetter.action.PUT_GLOBAL" | |
const val ACTION_PUT_SECURE = "com.github.simonpham.devetter.action.PUT_SECURE" | |
const val ACTION_PUT_SYSTEM = "com.github.simonpham.devetter.action.PUT_SYSTEM" | |
// some constants | |
const val EXTRA_KEY = "com.github.simonpham.devetter.extra.KEY" | |
const val EXTRA_VALUE = "com.github.simonpham.devetter.extra.VALUE" | |
const val EXTRA_VALUE_TYPE = "com.github.simonpham.devetter.extra.VALUE_TYPE" | |
// <DATA TYPE> | |
const val DATA_TYPE_INT = 0 | |
const val DATA_TYPE_LONG = 1 | |
const val DATA_TYPE_FLOAT = 2 | |
const val DATA_TYPE_STRING = 3 | |
// Step 3: call this on your app | |
// example usage: | |
// taken from https://github.com/simonpham/Tiles-For-Developers/blob/master/app/src/main/java/com/github/simonpham/devtiles/DeveloperSettings.kt | |
val intent = Intent(/* <ACTION TYPE> */) | |
.setComponent(ComponentName( | |
"com.github.simonpham.devetter", | |
"com.github.simonpham.devetter.DevetterService" | |
)) | |
.putExtra(EXTRA_KEY, key) | |
.putExtra(EXTRA_VALUE, value) | |
.putExtra(EXTRA_VALUE_TYPE, /* <DATA TYPE> */) | |
context.startService(intent) | |
// Example to enable Developer Settings -> Show touches | |
// Taken from https://github.com/simonpham/Tiles-For-Developers/blob/master/app/src/main/java/com/github/simonpham/devtiles/service/tiles/ShowTapsService.kt | |
val intent = Intent(ACTION_PUT_SYSTEM) | |
.setComponent(ComponentName( | |
"com.github.simonpham.devetter", | |
"com.github.simonpham.devetter.DevetterService" | |
)) | |
.putExtra(EXTRA_KEY, "show_touches") // key & value only accept String | |
.putExtra(EXTRA_VALUE, "1") // key & value only accept String | |
.putExtra(EXTRA_VALUE_TYPE, DATA_TYPE_INT) | |
context.startService(intent) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment