Android Question Lock System Date/time

acc

Member
Licensed User
Longtime User
Hi,

Is there a way not to allow changing of date/time of the device?

We are creating an app which is date sensitive and we don't want our users to tinker with the date and time of the device.

Thanks.
 
Hi,

Is there a way not to allow changing of date/time of the device?

We are creating an app which is date sensitive and we don't want our users to tinker with the date and time of the device.

Thanks.
You can't prevent to allow user to change the data/time of his device. You can use a NTP server to works with data and check correctly the current
 
  • Like
Reactions: acc
Upvote 0
  • Like
Reactions: acc
Upvote 0
You can use this code which checks if "Automatic date and time" system setting is enabled on the device:
Code:
Sub CheckAutoTime As Boolean
   Dim p As Phone
   Dim s As String
   If p.SdkVersion >= 17 Then s = "android.provider.Settings.Global" Else  s = "android.provider.Settings.System"
   Dim ctxt As JavaObject
   ctxt.InitializeContext
   Dim jo As JavaObject
   Return jo.InitializeStatic(s).RunMethod("getInt", Array(ctxt.RunMethod("getContentResolver", Null), "auto_time", 0)) = 1
End Sub
 
  • Like
Reactions: acc
Upvote 0
we don't want our users to tinker with the date and time of the device.
Getting the time from a time server:
But what happened when there is no internet connectivity? I think the SNTP date/time is the same as system date/time, in which case it can be changed and tampered with. Am I wrong?
You can use this code which checks if "Automatic date and time" system setting is enabled on the device:
But that does not prevent one from turning the auto time off in settings, change the date/time manually, save records with the tampered date/time and turn auto on again. Am I wrong?
 
  • Like
Reactions: acc
Upvote 0
Back
Top