I am developing a widget for my application, which can change the system time of the device. I know, that the device has to be rooted, that should not be the problem.
You can add 2, 15 or 31 days to the system time.
So far I was working with this method and it was working fine.
Now, that Android M will come out soon, I tested my application on the Android M Preview 3 and I got the problem, that the above code only displays the date change on my widget but it won't change it on the device.
I tested a few formats in the adb shell and had a solution, that nearly fit what I want.
command = "date -u "+month+day+hour+minute+year+"."+second+"\n";
Now, the date of the device is changed BUT when i add 2 days it will also add 2 hours to the date. For example: 10.09.2015 09:43 -> 12.09.2015 11:43
And if I check "Automatic date and time" in the settings after changing the date a couple of times, the device changes to a random date a few days in the past, which won't be reset at all until i restart the device.
Any thoughts on this?