A Tauri v2 plugin that enables Android APK installation through the system install intent.
- ✅ Launch Android's system APK installer for any APK file
- ✅ Android 7.0+ FileProvider support for secure file sharing
- ✅ Automatic permission handling (REQUEST_INSTALL_PACKAGES on Android 8.0+)
- ✅ Platform-specific: throws error on non-Android platforms (desktop/iOS)
Add to your src-tauri/Cargo.toml:
[dependencies]
tauri-plugin-apk-intent = { git = "https://github.com/smartclock-app/tauri-plugin-apk-intent" }In your src-tauri/src/lib.rs:
fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_apk_intent::init())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}In your src-tauri/capabilities/default.json:
{
"permissions": ["apk-intent:default"]
}async function installMyApp() {
try {
// Pass absolute file path to the APK
await invoke("plugin:apk-intent|install_apk", {
payload: {
path: "/storage/emulated/0/Download/app.apk",
},
});
console.log("Install intent launched!");
} catch (error) {
console.error("Installation failed:", error);
// On desktop/iOS: "APK installation is only supported on Android"
}
}- Minimum SDK: 21 (Android 5.0)
- Target SDK: 26+ recommended (for proper permission handling)
- Permission:
REQUEST_INSTALL_PACKAGES(automatically added by plugin)
The plugin automatically:
- Uses FileProvider for Android 7.0+ (secure file URIs)
- Falls back to
file://URIs for Android 6.0 and below - Handles permission prompts on Android 8.0+ (user will see system dialog)
Desktop (Windows, macOS, Linux) and iOS will throw an error:
Error: APK installation is only supported on Android
- Validates the APK file exists and has
.apkextension - Converts file path to appropriate URI (FileProvider or file://)
- Launches system install intent with
ACTION_INSTALL_PACKAGE - Returns immediately (does not wait for user to complete installation)
Apache-2.0
- The plugin only launches the installer UI - it doesn't programmatically install the APK
- Users must manually confirm the installation in the system dialog
- On Android 8.0+, users must grant "Install unknown apps" permission if not already granted
- Silent installation requires system/privileged app status (not supported by this plugin)