读书人

Android 批改系统时间

发布时间: 2012-06-30 17:20:12 作者: rapoo

Android 修改系统时间

android ?API中有SystemClock.setCurrentTimeMillis()函数来修改系统时间。

?

源码:

?/**

? ? ?* Sets the current wall time, in milliseconds. ?Requires the calling

? ? ?* process to have appropriate permissions.

? ? ?*

? ? ?* @return if the clock was successfully set to the specified time.

? ? ?*/

? ? native public static boolean setCurrentTimeMillis(long millis);

?

?

有两个方法:

? 第一个方法简单点,不过需要在Android系统源码的情况下用make来编译:

1. 在应用程序的AndroidManifest.xml中的manifest节点中插手android:sharedUserId="android.uid.system"这个属性。

2. 修改Android.mk文件,插手LOCAL_CERTIFICATE := platform这一行

3. 使用mm命令来编译,生成的apk就有修改系统时间的职权范围了。

? 第2个方法麻烦点,不外不消开虚拟机跑到源码情况下用make来编译:

1. 同上,插手android:sharedUserId="android.uid.system"这个属性。

2. 使用eclipse编译出apk文件,但是这个apk文件是不能用的。

3. 使用针系统的platform密码钥匙来从头给apk文件签名。signapk platform.x509.pem platform.pk8 input.apk output.apk

?

读书人网 >Android

热点推荐