Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent user changing system date/time (in Android)?

Tags:

I have googled, but I can find no advice to prevent user change system date/time in android.

We are developing an Enterprise Application, we would like to prevent the user of the device to be able to set time settings. In other words, we want to set a policy which defines, that user cant change date and time in android device. Are there any recommendations to do this? Thanks.

like image 634
Faisal Silitonga Avatar asked Oct 17 '12 02:10

Faisal Silitonga


People also ask

Is there a way to detect when the user has changed the clock Time on their device?

Yes, there is. The ACTION_TIME_CHANGED Intent is broadcast when the device time is changed, and you can have a method which will trigger when this Intent is detected. This intent has been in Android since API level 1, so it should work on any platform you might need to be compatible with.

How does automatic Date and Time work on Android?

Previous Android releases provided two ways to set date and time — either manually set per user or by automatic time detection, set by one of these two options: telephony uses Network Identity and Time Zone (NITZ) telephony signals. network uses Network Time Protocol (NTP) time servers.


2 Answers

Here is a third alternative that should significantly save on battery life:

Register a BroadCast Receiver for when the time gets changed by the user. Then disable the app until the device time is checked against network-time or server-time.

Those Broadcast Receivers exist. I just checked now with this app called Internal Broadcast Monitor I just found on Google Play.

enter image description here

Here is the interesting part below where I changed both the time and the date:

enter image description here

And below is the part where I changed the time zone: enter image description here.

like image 145
Stephan Branczyk Avatar answered Dec 18 '22 19:12

Stephan Branczyk


Since there is no policy support for this in the device administrator framework, you can't. File a feature request, it might get added in a next version.

like image 29
Nikolay Elenkov Avatar answered Dec 18 '22 19:12

Nikolay Elenkov