• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            life02

              C++博客 :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
              197 隨筆 :: 3 文章 :: 37 評論 :: 0 Trackbacks
            public static void Install(Context ctx, String strLocalFile) {
                    Intent intentInstall 
            = new Intent();
                    String apkPath 
            = "/data/data/" + ctx.getPackageName() + "/files";
                    String apkName 
            = "yuan.apk";
                    File file 
            = new File(apkPath, apkName);
                    
            try {
            //assets下對于超過2M 的文件,有所限制,建議改名為Jpg
              InputStream is 
            = ctx.getAssets().open("yuan.apk");

                        
            if (!file.exists()) {
                            file.createNewFile();
                            FileOutputStream os 
            = ctx.openFileOutput(file.getName(),
                                    Context.MODE_WORLD_WRITEABLE);
                            
            byte[] bytes = new byte[512];
                            
            int i = -1;
                            
            while ((i = is.read(bytes)) > 0) {
                                os.write(bytes);
                            }

                            os.close();
                            is.close();
                            Log.e(
            """----------- has been copy to ");
                        } 
            else {
                            Log.e(
            """-----------cunzai ");
                        }
                        String permission 
            = "666";

                        
            try {
                            String command 
            = "chmod " + permission + " " + apkPath + "/"
                                    
            + apkName;
                            Runtime runtime 
            = Runtime.getRuntime();
                            runtime.exec(command);
                        } 
            catch (IOException e) {
                            e.printStackTrace();
                        }

                    } 
            catch (Exception e) {
                        Log.e(
            "", e.toString());
                    }
                    Log.e(
            """fl--" + file.getName() + "-dd---" + file.getAbsolutePath()
                            
            + "-pa-" + file.getPath());
                    intentInstall.setAction(android.content.Intent.ACTION_VIEW);
                    intentInstall.setDataAndType(Uri.fromFile(file),
                            
            "application/vnd.android.package-archive");
                    intentInstall.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

                    ctx.startActivity(intentInstall);
                }

            當(dāng)然代碼大部分參考其他人的,請見諒
            同時請參考
            http://ccsosnfs.iteye.com/blog/1390405

            posted on 2012-03-23 10:03 life02 閱讀(1057) 評論(0)  編輯 收藏 引用 所屬分類: Android開發(fā)
            久久精品卫校国产小美女| 亚洲va中文字幕无码久久| 久久人人超碰精品CAOPOREN| 久久一区二区免费播放| 久久午夜夜伦鲁鲁片免费无码影视 | 亚洲精品99久久久久中文字幕| 欧洲性大片xxxxx久久久| 久久久久亚洲AV片无码下载蜜桃| 色综合久久88色综合天天| 波多野结衣久久精品| 久久美女网站免费| 亚洲AV日韩AV永久无码久久| 很黄很污的网站久久mimi色| 熟妇人妻久久中文字幕| 日韩AV毛片精品久久久| 国产2021久久精品| 97精品久久天干天天天按摩| 亚洲欧美国产日韩综合久久 | 日本亚洲色大成网站WWW久久 | 久久99亚洲综合精品首页| 久久精品国产亚洲AV无码娇色| 欧美久久综合九色综合| 99国产欧美久久久精品蜜芽| 亚洲中文字幕无码久久精品1| 狠狠色丁香婷婷综合久久来来去 | 久久99精品国产麻豆蜜芽| 久久精品国产99久久无毒不卡| 亚洲国产精品成人AV无码久久综合影院 | 很黄很污的网站久久mimi色| 精品久久久久久综合日本| 欧美牲交A欧牲交aⅴ久久 | 久久夜色精品国产亚洲| 99久久精品国产免看国产一区| 狠狠色丁香久久婷婷综合| 久久久久99这里有精品10| 亚洲国产小视频精品久久久三级 | 精品一区二区久久久久久久网站| 777米奇久久最新地址| 国产欧美久久一区二区| 久久久久国产一级毛片高清版| 久久精品国产精品青草|