I have an Android application sending via TCP sockets to another Android phone or PC, I want to synch the clock of sender and receiver clocks. I have tried SystemClock.setCurrentTimeMillis on android but it’s not working even using the permission android.permission.SET_TIME.
is there another way?
I have an Android application sending via TCP sockets to another Android phone or
Share
Unfortunately you can’t change the time of your android phone from code,as you don’t have the privilege of setting android.permission.SET_TIME.You could do it only on a rooted phone.
So why not let your both application update from a trusted source like internet time.
Maybe use android sntp client
OR what you can do is: send the current time on your phone to the pc and set the time of your pc,via what program you are using to recieve data.
Also take a look here: set mobile time and date