Install an Android app from my Processing Android app

Hello,

I want install app via my processing app. I have see “INSTALL_PACKAGE”, but how i can install app from a processing app?

1 Like

You don’t want INSTALL_PACKAGES. That’s reserved for system applications like the package manager. Instead, you want REQUEST_INSTALL_PACKAGES if you’re targetting API level 25 or higher - otherwise you don’t need any permission at all.

You can’t install packages directly for security reasons, but you can request the package manager to install them for you. See StackOverflow. It should look something like this:

import android.content.Intent;
import android.net.Uri;
import java.io.File;

File apkFile = new File("path/to/my/apk/");

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getActivity().startActivity(intent);
2 Likes

Thanks for your reply, it’s work