0.1.2 • Published 2 years ago
capacitor-plugin-version v0.1.2
capacitor-plugin-version
Can realize forced and non-forced updates of APP
Install
npm install cordova-plugin-apkupdater
npm install capacitor-plugin-version
npx cap syncAPI
checkUpdates(...)
checkUpdates(options: { url: string; appid: string; version: string; }) => Promise<void>更新程序启动器 在网页开始加载时使用
| Param | Type |
|---|---|
options | { url: string; appid: string; version: string; } |
getVersion()
getVersion() => Promise<string>获取版本信息
Returns: Promise<string>
How to Use
Get Version Number: Utilize the
@capacitor/apppackage to obtain the version number.Invoke After Page Load: Call the
version.checkUpdates()function after the page has loaded, providing the following parameters:url: The URL to query for the latest version.appid: The unique identifier for the app.version: The version number of the app.
Example Usage:
import { App as CapacitorApp } from '@capacitor/app';
// Step One: Get Version Number
const versionNumber = CapacitorApp.getVersion();
// Step Two: Invoke After Page Load
version.checkUpdates({
url: 'URL for querying the latest version',
appid: 'Unique identifier for the app',
version: versionNumber
});Remember to replace 'URL for querying the latest version' and 'Unique identifier for the app' with the actual values corresponding to your application.