ADB command to set system properties-
adb shell setprop test.android.Sysprop Sandeep
Android code:
try {
Class clazz = Class.forName("android.os.SystemProperties");
//Parameters Types
@SuppressWarnings("rawtypes")
Class[] paramTypes = new Class[1];
paramTypes[0] = String.class;
Method get = clazz.getMethod("get", paramTypes);
//Parameters
Object[] params = new Object[1];
params[0] = "test.android.Sysprop";
String ret = (String) get.invoke(clazz, params);
Log.i(TAG,"ret:"+ret);
}catch(Exception e){
Log.e(TAG,e.getMessage(),e);
}
adb shell setprop test.android.Sysprop Sandeep
Android code:
try {
Class clazz = Class.forName("android.os.SystemProperties");
//Parameters Types
@SuppressWarnings("rawtypes")
Class[] paramTypes = new Class[1];
paramTypes[0] = String.class;
Method get = clazz.getMethod("get", paramTypes);
//Parameters
Object[] params = new Object[1];
params[0] = "test.android.Sysprop";
String ret = (String) get.invoke(clazz, params);
Log.i(TAG,"ret:"+ret);
}catch(Exception e){
Log.e(TAG,e.getMessage(),e);
}