Created
August 5, 2011 23:51
-
-
Save varis/1128798 to your computer and use it in GitHub Desktop.
Android / System Services
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
| // AndroidManifest.xml must have the following permission: | |
| // <uses-permission android:name="android.permission.GET_TASKS"/> | |
| ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); |
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
| AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); |
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
| AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); |
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
| ClipboardManager clipboardManager = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); |
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
| // AndroidManifest.xml must have the following permission: | |
| // <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> | |
| ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); |
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
| InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); |
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
| try { | |
| final Class<?> sysProp = Class.forName("android.os.SystemProperties"); | |
| final Method get = sysProp.getMethod("get", new Class<?>[]{String.class}); | |
| final String ret = (String) get.invoke(sysProp, new Object[]{"persist.sys.aabbcc"}); | |
| } catch (Exception e) { | |
| // TODO Auto-generated catch block | |
| e.printStackTrace(); | |
| } | |
| // adb shell setprop / getprop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment