Installing apk from an app from another app already installed

Asked

Viewed 52 times

-2

After research I found nothing recent or specific about it, so I decided to ask here. In the company where I work we have some mobile solutions and different customers use different sets of Apps. Thus, we were required to write an application that should be able to install the apks (and eventually update) of the other apps of our ecosystem on the device, all without user interaction. Well, I know that in the device settings I can indicate the app with permission to install, but still, as far as I know, the user needs to interact.

I wonder if this is possible to be done without the user participating in the process and what would be the way, if they can indicate some more detailed material.

Thank you very much for your attention!

  • If I’m not mistaken, the latest versions of Android do not allow the installation of an APK without confirmation, even if you release the application to perform installations.

  • @Rafaeltavares thank you so much for the return.

1 answer

0

Install apks outside the store has to have Developer permission released on the Android operating system (at least in the most current versions of the system I believe it is like this)

If you choose to place in the play store you can open "an Activity" with the playstore, as described in the documentation https://developer.android.com/distribute/marketing-tools/linking-to-google-play

For example:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(
        "https://play.google.com/store/apps/details?id=com.example.android"));
intent.setPackage("com.android.vending");
startActivity(intent);

And to avoid opening this Activity if the app is already installed you can use the getApplicationInfo (that you can check if it is enabled as well) or simply use the getInstalledApplications and check on the list

That is, you induce the user to install via playstore the app if not installed yet, thus facilitating and without root or Developer permissions.

I’m a little rusty on Android, but I think with https://developer.android.com/reference/android/content/pm/PackageInstaller you can do this because since API 29 ACTION_INSTALL_PACKAGE [and considered obsolete

Probably using installExistingPackage that will require permission Manifest.permission.INSTALL_PACKAGES (should not use with third party packages)


You can also try Google play Instant:

Intent intent = new Intent(Intent.ACTION_VIEW);
Uri.Builder uriBuilder = Uri.parse("https://play.google.com/store/apps/details")
    .buildUpon()
    .appendQueryParameter("id", "com.example.android")
    .appendQueryParameter("launch", "true");

uriBuilder.appendQueryParameter("referrer", "exampleCampaignId");

intent.setData(uriBuilder.build());
intent.setPackage("com.android.vending");
startActivity(intent);

That way he won’t even install (https://developer.android.com/topic/google-play-instant), however the app that will use this service needs to follow a number of situations to be made available as Instant: https://developer.android.com/topic/google-play-instant/guides/reduce-module-size

  • Thanks for the wealth of details William. I will try the options you gave and see which one would be more viable for the customer. Great hug.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.