패키지, 저장소 및 앱 카테고리 검색

패키지 상세v2.1.0

install_plugin

안드로이드용 APK 설치를 위한 플러터 플러그인이며, iOS에서는 URL을 사용하여 앱 스토어로 이동합니다.

AndroidiOS
30일 다운로드
1.4만
좋아요
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 사용자를 앱 스토어로 리디렉션 중
  • 통합 앱 배포
  • 앱 내 업데이트 프롬프트
  • 오프라인 앱 설치

주요 기능

  • Android APK 설치
  • iOS 앱 스토어 리디렉션
  • 크로스 플랫폼 지원
  • pub.dev를 통한 간단한 통합
  • 오픈소스 코드베이스
  • URL 기반 iOS 탐색

적합한 대상

  • 자기 업데이트 앱을 개발하는 개발자
  • 오프라인 설치가 필요한 앱
  • 사용자 지정 APK를 배포하는 프로젝트
  • 앱 내 업데이트 로직을 갖춘 모바일 앱
  • 투명한 업데이트 메커니즘을 필요로 하는 팀

고려 사항

  • APK 설치를 위해 Android 권한이 필요합니다
  • iOS는 App Store 리디렉션만 지원합니다
  • 안드로이드에서 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'] ?? ''}'}");
  }

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트