Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AssetManager assetManager = getAssets();
- InputStream in = null;
- OutputStream out = null;
- try {
- in = assetManager.open("PreloaderAIR-captive-runtime.apk");
- FileOutputStream outputStream = openFileOutput("PreloaderAIR-captive-runtime.apk", Context.MODE_PRIVATE);
- byte[] buffer = new byte[1024];
- int read;
- while((read = in.read(buffer)) != -1) {
- outputStream.write(buffer, 0, read);
- }
- in.close();
- in = null;
- outputStream.close();
- outputStream = null;
- Intent intent = new Intent(Intent.ACTION_VIEW);
- File a = new File(getApplicationContext().getFilesDir(),"PreloaderAIR-captive-runtime.apk");
- if (a.exists())
- {
- Uri b = Uri.fromFile(a);
- intent.setDataAndType(b,"application/vnd.android.package-archive");
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- startActivity(intent);
- }
- } catch(Exception e) {
- System.out.println(e.getMessage());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement