for the GPS part is pretty straight forward:
You have to ask the LocationManager
for a GPS fix, whenever you receive it you'll have a Location
object.
Do some math with getElapsedRealtimeNanos()
and getTime()
on this location object to calculate the exact time.
as per the root part, not really necessary, but there's some nice amount of hack and work around on it: How to set mobile system time and date in android?