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

パッケージ詳細v2.1.0

install_plugin

Android向けのAPKインストール用のFlutterプラグイン。iOSではURLを使用してApp Storeに移動します。

AndroidiOS
30日間ダウンロード
1.3万
いいね数
79
Pub ポイント
150

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

flutter pub add install_plugin

パッケージ概要

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

install_plugin は、Android アプリが直接 APK ファイルをインストールできるようにする Flutter パッケージです。これにより、スムーズなアプリの更新やインストールが可能になります。iOS では、提供された URL を通じてユーザーを App Store にリダイレクトし、Apple の配布ポリシーと互換性を確保します。アプリの更新シーンに特化しており、ユーザーが外部ソースから手動でダウンロードする必要なく、新しいバージョンを簡単に配信できます。このプラグインは Android および iOS の両方をサポートし、アプリインストールワークフローを管理するためのクロスプラットフォームソリューションを提供します。pub.dev を介して簡単に統合でき、透明性とカスタマイズ性のためにオープンソースコードを含んでいます。

用途

  • アプリの自動更新機能
  • Androidへの直接APKインストール
  • iOS ユーザーを App Store にリダイレクトしています
  • バンドルされたアプリ配布
  • アプリ内での更新プロンプト
  • オフラインアプリのインストール

主な機能

  • Android APKのインストール
  • iOS アプリストアへのリダイレクト
  • クロスプラットフォーム対応
  • pub.dev を通じたシンプルな統合
  • オープンソースコードベース
  • URLベースのiOSナビゲーション

適している対象

  • 自己更新アプリを開発する開発者
  • オフラインインストールを必要とするアプリ
  • カスタム APK を配布するプロジェクト
  • アプリ内更新ロジックを備えたモバイルアプリ
  • 透明な更新メカニズムを必要とするチーム

注意事項

  • APK のインストールに Android の権限が必要です
  • iOS は App Store リダイレクトのみをサポートしています
  • AndroidでのAPKインストールにはユーザーの許可が必要です
  • 公式のApp Store提出には適していません
  • Android および iOS プラットフォームに限定
  • 信頼できないAPKソースに関するセキュリティリスク

元の README

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

install_plugin

Build Status pub package license

We use the install_plugin plugin to install apk for android; and using url to go to app store for iOS.

Usage

To use this plugin, add install_plugin as a dependency in your pubspec.yaml file. For example:

dependencies:
  install_plugin: '^2.1.0'

iOS

Your project need create with swift.

Android

You need to request permission for READ_EXTERNAL_STORAGE to read the apk file. You can handle the storage permission using flutter_permission_handler.

 <!-- read permissions for external storage -->
 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

In Android version >= 8.0 , You need to request permission for REQUEST_INSTALL_PACKAGES to install the apk file

<!-- installation package permissions -->
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

In Android version <= 6.0 , You need to request permission for WRITE_EXTERNAL_STORAGE to copy the apk from the app private location to the download directory

<!-- write permissions for external storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Example

install apk from the internet

  _networkInstallApk() async {
    if (_progressValue != 0 && _progressValue < 1) {
      _showResMsg("Wait a moment, downloading");
      return;
    }

    _progressValue = 0.0;
    var appDocDir = await getTemporaryDirectory();
    String savePath = appDocDir.path + "/takeaway_phone_release_1.apk";
    String fileUrl =
        "https://s3.cn-north-1.amazonaws.com.cn/mtab.kezaihui.com/apk/takeaway_phone_release_1.apk";
    await Dio().download(fileUrl, savePath, onReceiveProgress: (count, total) {
      final value = count / total;
      if (_progressValue != value) {
        setState(() {
          if (_progressValue < 1.0) {
            _progressValue = count / total;
          } else {
            _progressValue = 0.0;
          }
        });
        print((_progressValue * 100).toStringAsFixed(0) + "%");
      }
    });

    final res = await InstallPlugin.install(savePath);
    _showResMsg(
        "install apk ${res['isSuccess'] == true ? 'success' : 'fail:${res['errorMessage'] ?? ''}'}");
  }

install apk from the local storage

  _localInstallApk() async {
    FilePickerResult? result = await FilePicker.platform.pickFiles();
    if (result != null) {
      final res = await InstallPlugin.install(result.files.single.path ?? '');
      _showResMsg(
          "install apk ${res['isSuccess'] == true ? 'success' : 'fail:${res['errorMessage'] ?? ''}'}");
    } else {
      // User canceled the picker
      _showResMsg("User canceled the picker apk");
    }
  }

Go to AppStore , example appStore url : https://itunes.apple.com/cn/app/%E5%86%8D%E6%83%A0%E5%90%88%E4%BC%99%E4%BA%BA/id1375433239?l=zh&ls=1&mt=8

  _gotoAppStore(String url) async {
    url = url.isEmpty ? _defaultUrl : url;
    final res = await InstallPlugin.install(url);
    _showResMsg(
        "go to appstroe ${res['isSuccess'] == true ? 'success' : 'fail:${res['errorMessage'] ?? ''}'}");
  }

カテゴリー

ソースリポジトリ

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