當前位置:首頁 » 安卓系統 » android靜默root

android靜默root

發布時間: 2023-07-06 19:39:48

⑴ 檢測Android手機是否具有root許可權和靜默安裝

樓主想檢測手機有沒有root的話可以下載一個電腦版的應用寶,用數據線連接手機和電腦,打開手機系統設置-開發人員選項-USB調試,連接成功之後再我的手機工具箱裡面點擊一鍵root。如果手機已經獲取成功,會顯示手機已處於root狀態,繼續的話就可以解除了,如果手機沒有獲取成功,會顯示獲取許可權的過程,至於靜默安裝一般是在手機的市場裡面進行設置的,希望幫到你

⑵ Android 靜默安裝和自啟動(1、Root環境下)

各種以android硬體平台為基礎的【公示屏】、【廣告屏】等等,雖然很少有升級,但是不可避免的會遇到,而此類APP的使用場景,一般沒人會去幫助你版本更新,點擊安裝,故而需要:靜默安裝。

1、確認安裝包是否存在,並可讀寫
2、隱示啟動:action和data的schema來控制彈出安裝工具類APP,然後點擊安裝...
3、升級完:BootReceiver 監聽到Intent.ACTION_PACKAGE_REPLACED,然後自啟動

靜默安裝apk介面,無需開放root,也無需system許可權。

⑶ android在root許可權下實現apk的靜默卸載,靜默安裝,重啟

1.靜默卸載實現:

/**

    * 靜默卸載app

    *

    * @param context

    * @param packageName app的包名

    * @throws IOException

    * @throws InterruptedException

    */

    public static void uninstallApp(Context context, String packageName) throws IOException, InterruptedException {

        List<PackageInfo> packageInfos = context.getPackageManager().getInstalledPackages(PackageManager.GET_ACTIVITIES);

        for (PackageInfo packageInfo1 : packageInfos) {

            if (packageName.equals(packageInfo1.packageName)) {

                String suPath = "/system/xbin/su";

                File file = new File(suPath);

                if (!file.exists()) {

                    suPath = "/system/bin/su";

                }

                Process process = Runtime.getRuntime().exec(suPath);

                String cmd = "pm uninstall " + packageName + "\n" + "exit\n";

                process.getOutputStream().write(cmd.getBytes());

                process.waitFor();

                break;

            }

        }

    }

2.靜默安裝實現:

/**

    * 靜默安裝app

    *

    * @param filePath

    * @throws IOException

    * @throws InterruptedException

    */

    public static void installApp(String filePath) throws IOException, InterruptedException {

        String suPath = "/system/xbin/su";

        File file = new File(suPath);

        if (!file.exists()) {

            suPath = "/system/bin/su";

        }

        Process process = Runtime.getRuntime().exec(suPath);

        String cmd = "pm install -r " + filePath + "\n" + "exit\n";

        process.getOutputStream().write(cmd.getBytes());

        process.waitFor();

    }

最後加上重啟命令:

/**

    * 重啟系統

    *

    * @return

    */

    public static boolean reboot() {

        try {

            String suPath = "/system/xbin/su";

            File file = new File(suPath);

            if (!file.exists()) {

                suPath = "/system/bin/su";

            }

            Process process = Runtime.getRuntime().exec(suPath);

            String cmd = "reboot\nexit\n";

            process.getOutputStream().write(cmd.getBytes());

            return true;

        } catch (IOException error) {

            return false;

        }

    }

注意卸載和安裝需要在子線程中執行;如果單純關機則用「reboot -p」命令。

⑷ android如何實現靜默安裝哦

原理

  • 靜默安裝、卸載的原理就是利用pm install命令來安裝apk,pm uninstall 來卸載apk.

  • 智能安裝是利用android系統提供的無障礙服務AccessibilityService,來模擬用戶點擊,從而自動安裝.

java">//靜默安裝
privatevoidinstallSlient(){
Stringcmd="pminstall-r/mnt/sdcard/test.apk";
Processprocess=null;
DataOutputStreamos=null;
BufferedReadersuccessResult=null;
BufferedReadererrorResult=null;
StringBuildersuccessMsg=null;
StringBuildererrorMsg=null;
try{
//靜默安裝需要root許可權
process=Runtime.getRuntime().exec("su");
os=newDataOutputStream(process.getOutputStream());
os.write(cmd.getBytes());
os.writeBytes(" ");
os.writeBytes("exit ");
os.flush();
//執行命令
process.waitFor();
//獲取返回結果
successMsg=newStringBuilder();
errorMsg=newStringBuilder();
successResult=newBufferedReader(newInputStreamReader(process.getInputStream()));
errorResult=newBufferedReader(newInputStreamReader(process.getErrorStream()));
Strings;
while((s=successResult.readLine())!=null){
successMsg.append(s);
}
while((s=errorResult.readLine())!=null){
errorMsg.append(s);
}
}catch(Exceptione){
e.printStackTrace();
}finally{
try{
if(os!=null){
os.close();
}
if(process!=null){
process.destroy();
}
if(successResult!=null){
successResult.close();
}
if(errorResult!=null){
errorResult.close();
}
}catch(Exceptione){
e.printStackTrace();
}
}
//顯示結果
tvTest.setText("成功消息:"+successMsg.toString()+" "+"錯誤消息:"+errorMsg.toString());
}

⑸ android沒有root的情況下怎麼實現靜默安裝

手機ROOT方法:x0dx0a1、下載安裝KingRoot 電腦版x0dx0a2、用USB數據線連接手機Root過程中,保持手機連接PCx0dx0a3、按提示開始Root操作整個過程需要5-10分鍾x0dx0a4、Root成功!x0dx0ax0dx0a註:手機ROOT之後是不在保修條約裡面的,需要解除ROOT許可權即可。

熱點內容
安卓如何設置桌面返回鍵 發布:2025-02-06 13:58:15 瀏覽:48
bi可視化php 發布:2025-02-06 13:50:15 瀏覽:931
shell寫腳本文件 發布:2025-02-06 13:47:32 瀏覽:231
健身器材腳本 發布:2025-02-06 13:46:36 瀏覽:856
怎麼從手機里卸載存儲卡 發布:2025-02-06 13:35:04 瀏覽:644
誅仙青雲志2ftp 發布:2025-02-06 13:34:48 瀏覽:34
mill91編程 發布:2025-02-06 13:10:27 瀏覽:294
華為平板怎麼儲存伺服器文件 發布:2025-02-06 12:49:21 瀏覽:482
php查詢結果數組 發布:2025-02-06 12:31:05 瀏覽:717
怎樣把照片壓縮打包 發布:2025-02-06 12:15:19 瀏覽:498