0

We're building an App using Ionic/cordova that will need to run on Android, iOS and Windows 10 Mobile.

The goal is to register start and stop events, we'll need the exact time and location when this events are registered.

There is a serious concern that the users will modify the timesettings on their phone to send false data.

As long as these events are sent immediately to the server, we can use the server time to validate what the user is sending us. But there is also a requirement to be able to work when offline.

Our first thought was to use the GPS time. In cordova the position object has a timestamp. https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-geolocation/

But after further reading, here and here, that this isn't necessarily the time of the GPS server but also just the local time. I've read about work arounds using the uptime of the device, but this won't work as soon as there is a reboot. But most of these conversations are a few years old.

For now we think the simples approach will be to flag events that are sent offline as 'suspicious'.

Is there any other way to accurately determine the time when you're offline without risk that the user tampered with it?

Community
  • 1
  • 1
Joris
  • 21
  • 6
  • I have that problem in android and at the end I use the scenario explained here : http://stackoverflow.com/questions/33449737/how-can-i-get-correct-current-date-and-time-for-android-device-while-device-is-o – Hossein Rashno Jul 10 '16 at 07:30

1 Answers1

0

Haven't tried it myself,but what about getting the time from the Network Provider, as said in this SO: I want to get time from GSM network

long networkTS = locMan.getLastKnownLocation(LocationManager.NETWORK_PROVIDER).getTime();

Time returned by getLastKnowLocation could be old if you want current time use

locMan.requestSingleUpdate() and pass the network provider

Though, this may not work in iOS or Windows.

Community
  • 1
  • 1
Sriram
  • 359
  • 1
  • 13
  • Hi Sriram, thanks for the suggestion, we can certainly look further at this. But perhaps I wasn't clear with my question, that the requirement in being offline would be that we also don't have a network connection with the provider. So I'm not sure if this would work then. – Joris Jun 17 '16 at 11:18