How to update the android time

2019-09-11 14:26发布

I am using android TAB for some app development . in my application I get UTC time from the other application(other device provides to my application via TCP socket ) . Once I receive this I need to update the time with receive time . Is there any apis to change the system time ..?

标签: android time
1条回答
Root(大扎)
2楼-- · 2019-09-11 14:59
public static boolean setCurrentTimeMillis (long millis)

Sets the current wall time, in milliseconds. Requires the calling process to have appropriate permissions. [although Only system process can change the time]

User apps cannot set the time. Only the system processes can. This is for security, but also because I think it won't have much effect-- the time does reset from the radio via network time.

reference link

查看更多
登录 后发表回答