private void installPackage() {
        AndPermission.with(this)
            .install()
            .file(new File(Environment.getExternalStorageDirectory(), "android.apk"))
            .rationale(new InstallRationale())
            .onGranted(new Action<File>() {
                @Override
                public void onAction(File data) {
                    // Installing.
                    toast(R.string.successfully);
                }
            })
            .onDenied(new Action<File>() {
                @Override
                public void onAction(File data) {
                    // The user refused to install.
                    toast(R.string.failure);
                }
            })
            .start();
    }
private void installPackage ( ) { AndPermission . with ( this ) . install ( ) . file ( new File ( Environment . getExternalStorageDirectory ( ) , "android.apk" ) ) . rationale ( new InstallRationale ( ) ) . onGranted ( new Action < File > ( ) { @ Override public void onAction ( File data ) { toast ( R . string . successfully ) ; } } ) . onDenied ( new Action < File > ( ) { @ Override public void onAction ( File data ) { toast ( R . string . failure ) ; } } ) . start ( ) ; }
Install package.