APK加载第三方APK
//将资源考入手机SDCARD private void copyBigDataBase() throws IOException { InputStream myInput; String outFileName = Path + "/" + Name; OutputStream myOutput = new FileOutputStream(outFileName); byte[] buffer = new byte[1024]; int length; myInput = AIDLActivity.this.getAssets().open("reader.apk"); while ((length = myInput.read(buffer)) > 0) { myOutput.write(buffer, 0, length); } myOutput.flush(); myInput.close(); } //弹出安装界面 private void install(){ Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(Path + "/" + Name)), "application/vnd.android.package-archive"); startActivity(intent); } //判断是否被安装过 private boolean Isapkinstall(){ PackageManager pm = this.getPackageManager(); Intent mainintent = new Intent(Intent.ACTION_MAIN, null); mainintent.addCategory(Intent.CATEGORY_LAUNCHER); List<ResolveInfo> resolveInfos = this.getPackageManager() .queryIntentActivities(mainintent, 0); for (ResolveInfo reInfo : resolveInfos) { if(reInfo.activityInfo.packageName.equals("com.adobe.reader")){ return true; } } return false; }
把第三方APK放到自己的资源,一起安装在手机上
浙公网安备 33010602011771号