flutter_mobile_upgrader

Last updated:

0 purchases

flutter_mobile_upgrader Image
flutter_mobile_upgrader Images
Add to Cart

Description:

flutter mobile upgrader

一个 Flutter 应用升级插件, 支持 Android 和 IOS, 插件的构思和设计来均自于 flutter_app_upgrade
安装 #


在 pubspec.yaml 添加
dependencies:
flutter_mobile_upgrader: ^1.0.7
copied to clipboard


在命令行运行如下
flutter pub get
copied to clipboard


使用 #
Android #


在 android/app/src/main/AndroidManifest.xml 添加 provider
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.xxxx.xxxxx"
>
<application>
...
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:grantUriPermissions="true"
android:exported="false"
>
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"
/>
</provider>
</application>
</manifest>
copied to clipboard


新增 android/app/src/main/res/xml/file_paths.xml 文件
<paths>
<external-path
name="external-path"
path="."
/>

<external-cache-path
name="external-cache-path"
path="."
/>

<external-files-path
name="external-files-path"
path="."
/>

<files-path
name="files_path"
path="."
/>

<cache-path
name="cache-path"
path="."
/>

<root-path
name="name"
path="."
/>
</paths>
copied to clipboard


点击升级前往应用商店
// 一般通过远程接口调用获取
final Future<AppUpgradeInfo> appUpgradeInfo = Future.value(
AppUpgradeInfo(
title: '更新提示',
contents: ['有新版本哟,请更新~', '修复了设备定位bug', '优化认证操作体验'],
force: true, // 是否强制升级
),
);

// 获取已上架的应用市场, 根据应用包名,例: 'com.flutter.app'
final appMarketInfos = AppMarketManager.getAppMarketList(
await FlutterUpgradeChanneler.getInstallMarket(['com.flutter.app']),
);

// 升级应用 Api
AppUpgradeManager.upgrade(
context, // BuildContext
appUpgradeInfo,
appMarketInfo: appMarketInfos[0],
onCancel: () {},
onOk: () {},
);
copied to clipboard







从指定的 Url 下载 apk
// 一般通过远程接口调用获取
final Future<AppUpgradeInfo> appUpgradeInfo = Future.value(
AppUpgradeInfo(
title: '更新提示',
contents: ['有新版本哟,请更新~', '修复了设备定位bug', '优化认证操作体验'],
force: true, // 是否强制升级
),
);

// 升级应用 Api
AppUpgradeManager.upgrade(
context, // BuildContext
appUpgradeInfo,
apkDownloadUrl: 'http://xxx.xxx.com/upgrade.apk',
onCancel: () {},
onOk: () {},
);
copied to clipboard





IOS #


点击升级前往应用商店
// 一般通过远程接口调用获取
final Future<AppUpgradeInfo> appUpgradeInfo = Future.value(
AppUpgradeInfo(
title: '更新提示',
contents: ['有新版本哟,请更新~', '修复了设备定位bug', '优化认证操作体验'],
force: true, // 是否强制升级
),
);

// 升级应用 Api
AppUpgradeManager.upgrade(
context, // BuildContext
appUpgradeInfo,
iosAppId: 'xxxxxxxx', // ios appId
onCancel: () {},
onOk: () {},
);
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.