Is possible to set System DateTime from my Android App?

孤街浪徒 提交于 2019-11-28 00:48:01

Eclipses,

I did quite a bit of checking for you on this and found an open ticket with Google to fix the problem. Only thing is the tag has been open since Nov 8, 2009. Basically only the system can change the time even with the Permission. According to comments on the link below a developer did some research and noted that when the permission SET_TIME was created, it wasn't given the appropriate protection level in the OS (signatureorSystem v.s dangerous). As a result it doesn't do what it is supposed to do.

http://code.google.com/p/android/issues/detail?id=4581

Here's an explanation of the various protection levels that permissions can have. Currently according to the developer cite above SET_TIME has "signatureorSystem" when it should have "dangerous".

http://developer.android.com/guide/topics/manifest/permission-element.html#plevel

In short there is currently no way to change the time programatically without rooting the phone.

One final note is that if you want to go with Custom roms there is also an open ticket for Cyanogenmod to add the ability to their rom as well.

http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=CyanogenMod+SET_TIME

Hope this helps some, George

According to this post, SET_TIME is the correct permission but it will only work on a rooted phone.

jek

we've done it. Not a big deal as long as you can get the SET_TIME pemission. See my answer to a similar question.

Regarding other answers stating that it's not possible without rooting the phone then this refers only to gaining the permission. For this see here and here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!