欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android實(shí)現(xiàn)關(guān)機(jī)重啟的方法分享

 更新時(shí)間:2014年02月28日 15:30:00   作者:  
這篇文章主要介紹了Android實(shí)現(xiàn)關(guān)機(jī)重啟的方法,需要的朋友可以參考下

實(shí)現(xiàn)系統(tǒng)重啟的APK需要system的權(quán)限,在AndroidManifest.xml中增加android:sharedUserId="android.uid.system",再修改簽名即可;

具體方法參考:

點(diǎn)擊打開(kāi)鏈接

1、使用PowerManager來(lái)實(shí)現(xiàn):
代碼:

復(fù)制代碼 代碼如下:

private void rebootSystem(){ 
    PowerManager pManager=(PowerManager) getSystemService(Context.POWER_SERVICE); 
    pManager.reboot(""); 

2、發(fā)送REBOOT廣播:
代碼:

復(fù)制代碼 代碼如下:

private void rebootSystem(){
 Intent reboot = new Intent(Intent.ACTION_REBOOT);
 reboot.putExtra("nowait", 1);
 reboot.putExtra("interval", 1);
 reboot.putExtra("window", 0);
 sendBroadcast(reboot);
}

相關(guān)文章

最新評(píng)論