Questions tagged [packageinstaller]

PackageInstaller offers the ability to install, upgrade, and remove applications on Android devices.

PackageInstaller Class offers the ability to install, upgrade, and remove applications on the Android device. This includes support for apps packaged either as a single "monolithic" APK, or apps packaged as multiple "split" APKs.

An app is delivered for installation through a PackageInstaller.Session, which any app can create. Once the session is created, the installer can stream one or more APKs into place until it decides to either commit or destroy the session. Committing may require user intervention to complete the installation.

Sessions can install brand new apps, upgrade existing apps, or add new splits into an existing app.

Apps packaged as multiple split APKs always consist of a single "base" APK (with a null split name) and zero or more "split" APKs (with unique split names). Any subset of these APKs can be installed together, as long as the following constraints are met:

  • All APKs must have the exact same package name, version code, and signing certificates.
  • All APKs must have unique split names.
  • All installations must contain a single base APK.

enter image description here

Read more

56 questions
24
votes
2 answers

PackageInstaller "Silent install and uninstall of apps by Device Owner” - Android M Preview

PackageInstaller (https://developer.android.com/reference/android/content/pm/PackageInstaller.html) seems to have been added starting in API 21 (Lollipop), however I have not found any solid code examples on how to install an APK via this API. Any…
21
votes
1 answer

Android PackageInstaller, re-open the app after it updates itself

I'm developing an app that runs as Device Owner, and I want to build an automatic updater inside it. To do it I use the PackageInstaller, as I have the privileges to use it due to my Device owner position. private void installPackage(InputStream…
16
votes
9 answers

Programmatically install an apk in Android 7 / api24

I am trying to get my app to automatically install an apk. This works fine for api<24. But for 24, it is failing. Android has implemented extra security: For apps targeting Android 7.0, the Android framework enforces the StrictMode API policy…
elsie
  • 163
  • 1
  • 1
  • 4
11
votes
2 answers

Android 7 open APK with ACTION_VIEW not working (Package installer has stopped)

My app has an auto update feature which download an APK and then uses a Intent.ACTION_VIEW to open the package installer. Up to 7 it worked perfectly (by feeding the Intent with a normal file://) With Android 7 I had to change to use a FileProvider.…
Johny19
  • 5,364
  • 14
  • 61
  • 99
7
votes
1 answer

Android 8 Bug: Starting apk installation via adb doesn't work, needs permission REQUEST_INSTALL_PACKAGES

I need to start the installation of an apk on an android 8 phone, but this should not be silent (adb install). The behavior should be as if the user has touched the apk file on the device. Before android 8 it was possible to launch the installation…
7
votes
2 answers

Android Lollipop - PackageInstaller.Session commit()

I'm trying to install packages on my device (from a device-owner app that runs on it) only by using the PackageInstaller and PackageManager APIs. I have been looking for examples but couldn't find anything that fit my need. Here is a sample of my…
6
votes
2 answers

android 7: NullPointerException on APK installing with Runtime.getRuntime().exec

I'm trying to install APK in android 7 (samsung and sony) using regular Runtime.getRuntime.exec() routine. The installation fails with the following exception in the logcat: 09-04 14:14:33.932 16623-16623/? D/AndroidRuntime: Calling main entry…
4
votes
1 answer

How to uninstall android apps using the new PackageInstaller api?

The old way of uninstalling android apps with ACTION_UNINSTALL_PACKAGE is deprecated in API level 29. Now it's recommended to use PackageInstaller.uninstall(packageName: String, statusReceiver: IntentSender) instead. This is what a came-up with so…
Toni Joe
  • 7,715
  • 12
  • 50
  • 69
4
votes
1 answer

How to get status when using Android PackageInstaller?

Edit: I added a solution for API level 29 or later. However, this does not solve my problem. I would appreciate if someone come up with a method for API level 28 or before. Original question: I am using following code to install apks: final int…
t.m.
  • 1,430
  • 16
  • 29
4
votes
0 answers

Problem with update android app silently without user interaction and root permission

I know there is many stack-overflow posts for this question, but i couldn't solve my problem using any of them. My app is only available for a limited group of people(inner company app), so i can't publish it in an app store and i want it to be…
3
votes
2 answers

Launch application after PackageInstaller finished (self) updating

After the PackageInstaller successfully (self) updates the application, the application closes and doesn't launch again. Possible duplicate: Android PackageInstaller, re-open the app after it updates itself The situation is pretty similar, ill show…
3
votes
0 answers

Why Is Android PackageInstaller Failing?

My Android activity/app is using DownloadManager and PackageInstaller to update itself. I'll post the relevant code here, but the bottom line is the file downloads successfully but does not install and there's no useful information in LogCat to help…
Bungles
  • 1,969
  • 2
  • 25
  • 54
3
votes
1 answer

How to properly install an APK file, so that the launcher will create a new app icon of it on the home screen?

Background I have a spare time app which I've made (here), that one of its main features is to install APK files. The problem Users who install apps expects that a new app icon will appear on the launcher. This can occur from the Play Store, but for…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
3
votes
0 answers

Package installer doesn't ask to click on "Done" or "Open" after updating app programmatically

My app has Auto-Update feature. I install apk file using this code: Uri uri; Intent intent; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { uri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", file); …
3
votes
2 answers

Package Installer crashes in Android M after requesting permission READ_SMS

I have a Login Fragment that tries to access (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE); this works well with devices up to Lollipop 5.1. And when I tried it in Marshmallow 6.01 it showed security exception. So I…
1
2 3 4