パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.0.3

android_package_installer

APK ファイルから Android パッケージをインストールするための Flutter プラグイン。このプラグインは Android パッケージインストーラーを使用し、最低 API レベルバージョン 21 を必要とします。

Android
30日間ダウンロード
6340
いいね数
27
Pub ポイント
160

パッケージをインストール

flutter pub add android_package_installer

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Flutterプラグインで、アプリ内からAndroid APKファイルを直接インストールできるようにします。AndroidパッケージインストーラAPIを利用しており、最小APIレベル21が必要です。これにより、開発者はアプリ内でのアップデートやサイドローディング機能を安全かつ効率的に実装できます。このプラグインはAndroid専用に設計されており、Flutterアプリとシームレスに統合されています。外部ツールやシステムインテントに頼らず、パッケージのインストールプロセスを簡素化しています。

用途

  • アプリ内アプリ更新
  • APK のサイドローディング
  • エンタープライズアプリケーションにおける自動デプロイメント
  • 直接的なAPKダウンロードによるアプリの更新

主な機能

  • ネイティブなAndroidパッケージインストーラーを使用
  • API レベル 21+ をサポート
  • シンプルな Flutter 統合
  • セキュアなインストールワークフロー
  • 外部のインテントは不要です

適している対象

  • アップデートシステムを構築している開発者
  • エンタープライズアプリ開発者
  • APKのインストールを必要とするアプリ
  • Android向けのFlutterアプリ

注意事項

  • Androidでのみ動作します
  • API レベル 21 以上が必要です
  • インストールにはユーザーの許可が必要です
  • APKファイル形式に制限
  • iOS をサポートしていません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

android_package_installer

A Flutter plugin for installing Android package from apk file. Plugin uses Android Package Installer and requires minimum API Level version 21.

Using

import 'package:android_package_installer/android_package_installer.dart';

  int? statusCode = await AndroidPackageInstaller.installApk(apkFilePath: '/sdcard/Download/com.example.apk');
  if (statusCode != null) {
    PackageInstallerStatus installationStatus = PackageInstallerStatus.byCode(statusCode);
    print(installationStatus.name);
  }

To install the Android package the application will need permissions. You can use the permission_handler package to request them.

Setup

  1. Add the permissions to your AndroidManifest.xml file in <projectDir>/android/app/src/main/AndroidManifest.xml:
    • android.permission.REQUEST_INSTALL_PACKAGES - required for installing android packages.
    • android.permission.READ_EXTERNAL_STORAGE - required to access the external storage where the apk file is located.
<manifest xmlns:tools="http://schemas.android.com/tools" ...>

  <!-- ADD THESE PERMISSIONS: -->
  <!-- Android 10 Permissions -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
  <!-- Android 11+ Permissions -->
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
<uses-permission
android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage"/>
  
  <application ...>
    <activity ...>

      ...

      <!-- ADD THIS INTENT FILTER -->
      <intent-filter>
        <action android:name="com.android_package_installer.content.SESSION_API_PACKAGE_INSTALLED"/>
      </intent-filter>
    </activity>

    <!-- ADD THIS PROVIDER -->
    <provider
      android:name="androidx.core.content.FileProvider"
      android:authorities="${applicationId}"
      android:grantUriPermissions="true">
      <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/file_paths"/>
    </provider>
  </application>
</manifest>
  1. Check external path in your custom paths file. If it doesn't exist, create it in <projectDir>/android/app/src/main/res/xml/file_paths.xml:
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <external-path name="external_files" path="."/>
</paths>

カテゴリー

依存関係

依存関係一覧 1 件

  • plugin_platform_interface^2.1.8

ソースリポジトリ

このパッケージを使用しているプロジェクト