@bixbyte/capacitor-apk-installer
v1.0.1
Published
Capacitor plugin for installing APK files on Android
Maintainers
Readme
@bixbyte/capacitor-apk-installer
Capacitor plugin for installing APK files on Android devices programmatically.
Installation
npm install @bixbyte/capacitor-apk-installer
npx cap syncUsage
import { ApkInstaller } from '@bixbyte/capacitor-apk-installer';
// Check if app has install permission
const { hasPermission } = await ApkInstaller.checkInstallPermission();
// Request install permission (opens Settings on Android 8+)
if (!hasPermission) {
await ApkInstaller.requestInstallPermission();
}
// Install an APK file
await ApkInstaller.installApk({
filePath: '/path/to/app.apk'
});API
checkInstallPermission()
Check if the app has permission to install packages.
Returns: Promise<{ hasPermission: boolean }>
requestInstallPermission()
Request permission to install packages. On Android 8+, this opens the system Settings.
Returns: Promise<{ success: boolean }>
installApk(options)
Install an APK file from the given path.
Parameters:
options.filePath(string): Absolute path to the APK file
Returns: Promise<{ success: boolean }>
Android Setup
This plugin requires the REQUEST_INSTALL_PACKAGES permission. Add it to your AndroidManifest.xml:
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />For Android 7.0+, you also need a FileProvider. Add this to your AndroidManifest.xml:
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>Platform Support
- ✅ Android
- ❌ iOS (not applicable)
- ❌ Web (not applicable)
License
MIT
