1

This code gets the system clock that user can easy change with a wrong time.

import java.util.Calendar

Date currentTime = Calendar.getInstance().getTime();

However, my apps relies on correct timestamp to work.

One solution is request the real time from my server but another requirement of my app is to be able to work offline.

So after research, I discovered that GPS also use timestamp. How to get the timestamp of the satellite in my app?

TSR
  • 17,242
  • 27
  • 93
  • 197
  • In about the same way as you would retrieve location lat,long. – blackapps Sep 22 '20 at 11:21
  • 1
    Possible duplicate: https://stackoverflow.com/q/7017069/812149 . It says there that Location has a [gettime method](https://developer.android.com/reference/android/location/Location.html#getTime%28%29). Not sure if that info is up to date however - Android tends to change a lot. – S.L. Barth is on codidact.com Sep 22 '20 at 11:26

0 Answers0