当前位置:操作系统 > 安卓/Android >>

android代码重启

先上代码:


[java]
Intent intent = new Intent(Intent.ACTION_REBOOT); 
intent.setAction(Intent.ACTION_REBOOT); 
intent.putExtra("nowait", 1); 
intent.putExtra("interval", 1); 
intent.putExtra("window", 0); 
sendBroadcast(intent); 

Intent intent = new Intent(Intent.ACTION_REBOOT);
intent.setAction(Intent.ACTION_REBOOT);
intent.putExtra("nowait", 1);
intent.putExtra("interval", 1);
intent.putExtra("window", 0);
sendBroadcast(intent);www.zzzyk.com
这是在调用的地方,只需发送如上的广播。

在androidmanifest.xml文件中在根标签manifest中添加权限


[java]
android:sharedUserId="android.uid.system" 

android:sharedUserId="android.uid.system"
添加上面的权限后,要源码编译。

Android.mk文件中要添加


[java]
LOCAL_CERTIFICATE := platform 

LOCAL_CERTIFICATE := platform
重启代码位于frameworks/base/core/jni/android_os_Power.cpp


作者:wu_shu_jun
补充:移动开发 , Android ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,