Skip to content

Feature Enhancement request: Support APK installation from file browser / APK view #6

Backlog

Description

@RohitSingh-04

Summary / Feature Request

Add support for installing .apk files directly from FileExplorer by declaring the required package-install permission (REQUEST_INSTALL_PACKAGES) and handling the Android package installer intent flow.

Current Behavior

When tapping an .apk file inside FileExplorer to install it, the Android system package installer does not appear or silently rejects the install request. Currently, the app supports inspecting APKs via the APK Analyzer, but cannot trigger standard APK installation on Android 8.0+ (API 26+).

Expected Behavior

Tapping an .apk file (or selecting an Install action from the file menu / APK Analyzer) should:

  1. Check if the app has permission to request package installs (PackageManager.canRequestPackageInstalls() on Android 8.0+ / API 26+).
  2. If not granted, redirect the user to the system Install unknown apps settings screen (Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES) for FileExplorer.
  3. Once granted, launch the system package installer using a content:// URI provided via FileProvider (Intent.ACTION_VIEW / Intent.ACTION_INSTALL_PACKAGE with FLAG_GRANT_READ_URI_PERMISSION).

Root Cause & Testing Notes

  • Environment tested: Xiaomi Redmi 7 (onclite), tested with FileExplorer installed as a system app.
  • Observation: Prior to modifying the manifest, tapping an APK failed to invoke the system package installer popup.
  • Verification: After adding the install permission declaration in AndroidManifest.xml (and rebuilding/re-signing), tapping an .apk file successfully triggered the Android package installer and installed apps as expected.

Suggested Fix

1. Declare Permission in AndroidManifest.xml

Add REQUEST_INSTALL_PACKAGES so Android allows FileExplorer to invoke the system package installer:

<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

2. Ensure FileProvider & Install Intent Handling

When opening/installing an .apk file on Android 7.0+ (API 24+) and Android 8.0+ (API 26+):

  • Check packageManager.canRequestPackageInstalls() on Build.VERSION.SDK_INT >= Build.VERSION_CODES.O. If false, prompt the user and open Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, Uri.parse("package:$packageName")).
  • Serve the APK file through FileProvider.getUriForFile(...) rather than a file:// URI, and launch the installer intent with Intent.FLAG_GRANT_READ_URI_PERMISSION and Intent.FLAG_ACTIVITY_NEW_TASK using MIME type application/vnd.android.package-archive.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions