Skip to content

Instantly share code, notes, and snippets.

@magnatronus
Created December 24, 2017 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magnatronus/178153c829d001a4534e1ee27560106b to your computer and use it in GitHub Desktop.
Save magnatronus/178153c829d001a4534e1ee27560106b to your computer and use it in GitHub Desktop.
Android SystemProperties access
/**
* Java Library to access System Property Info
*/
package uk.spiralarm;
import java.lang.reflect.*;
public class SystemInfo {
/**
* Attempt to extract selected data
* @return String
*/
public String getData(String data){
String result="none";
try {
Class<?> c = Class.forName("android.os.SystemProperties");
Method get = c.getMethod("get", String.class, String.class);
result = (String) get.invoke(c, data, "Error");
return result;
} catch(Exception ex){
return "Data Not Found";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment