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
public static String getSystemProp(String key) throws Exception { | |
Class<?> c = Class.forName("android.os.SystemProperties"); | |
Class<?>[] types = new Class[] {String.class}; | |
Method method = c.getMethod("get", types); | |
return (String) method.invoke(null, new Object[] {key}); | |
} |
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
private void settingDeviceDateTime(Date date) { | |
Calendar c = Calendar.getInstance(); | |
c.setTime(date); | |
SystemClock.setCurrentTimeMillis(c.getTimeInMillis()); | |
Log.d(TAG, "Setting time to: " + new SimpleDateFormat("MM/dd/yyyy hh:mm:ss").format(c.getTime())); | |
} |
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
public static String getPropSystem(String key) throws IOException { | |
BufferedReader bis = null; | |
try { | |
Process ifc = Runtime.getRuntime().exec("getprop " + key); | |
bis = new BufferedReader(new InputStreamReader(ifc.getInputStream())); | |
return bis.readLine(); | |
} finally { | |
bis.close(); | |
} | |
} |
NewerOlder