Question:
There was a need to programmatically change the time and date in the system. Android. As I understand it, access to setTime
at the kernel level.
How can you get around this?
Application for personal needs. Googling didn't give a working answer.
Answer:
it worked like this for me.
String s = time.format("%Y%m%d.%H%M%S");
Process process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(process.getOutputStream());
os.writeBytes("date -s " + s + ";");
os.flush();
os.close();
in the manifest
<uses-permission android:name="android.permission.SET_TIME"/>
but wants root-right. As without root – I did not find it.