【问题标题】:Automatically detect new versions of Ionic 3 app in PlayStore在 PlayStore 中自动检测新版本的 Ionic 3 应用程序
【发布时间】:2018-10-04 04:06:55
【问题描述】:

我正在尝试发布我的第一个 ionic app。我想知道用户如何知道PlayStore 有新的更新以及他们如何下载?

Ionic Native App Update (https://ionicframework.com/docs/native/app-update/ 2) 是什么?

当为新的更新版本构建应用程序时,增加config.xml 中的version no 是否足够?

widget id="io.ionic.888" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova .apache.org/ns/1.0"

【问题讨论】:

  • 如果您想在 Playstore 上更新您现有的应用程序,那么只需使用不同的版本上传即可,即如果您在 Playstore 上有 0.0.1,请使用 0.0.2 上传,以便您进行更新。
  • 你的意思是我不想在我的应用程序中安装任何库。我唯一要做的就是增加应用版本吗?
  • 有用的问题@GunarathneMDD

标签: ionic-framework ionic3 version


【解决方案1】:

您必须使用 App Update plugins 来验证 Playstore 是否提供更新。

Repo: https://github.com/vaenow/cordova-plugin-app-update

$ ionic cordova plugin add cordova-plugin-app-update
$ npm install --save @ionic-native/app-update

您应该首先在您的服务器上托管一个 XML 文件,其中包含以下数据:

<update>
    <version>302048</version>
    <name>APK Name</name>
    <url>https://your-remote-api.com/YourApp.apk</url>
</update>

然后使用下面的代码app.component.ts:

import { Component } from '@angular/core';
import { AppUpdate } from '@ionic-native/app-update';
import { Platform } from 'ionic-angular';


@Component({
    templateUrl: 'app.html'
})
export class MyApp {
    constructor(private appUpdate: AppUpdate) {
        this.platform.ready().then(() => {
            const updateUrl = 'https://your-remote-api.com/update.xml';
            this.appUpdate.checkAppUpdate(updateUrl).then(() => { console.log('Update available') });
        });
    }
}

插件会比较应用版本,如果API有更新版本需要安装,会提示更新。

【讨论】:

  • 好的,那么到什么url,我必须把我的playstore apk url放上去
  • 您的远程 Web 服务器 APK URL:your-remote-api.com/YourApp.apk 在 update.xml 文件中。
  • 对不起,我只把我的 apk 放在 PlayStore 中,没有放在远程 Web 服务器中。
  • 我对 XML &lt;version&gt;302048&lt;/version&gt; 感到困惑。如何定义版本?是我与&lt;widget version="1.0.0" ...&gt; 一起使用的那个吗?如果是这样,如果我定义一个新的更新,这就是&lt;version&gt;1.0.1&lt;/version&gt;?
  • 不要使用这个插件! Google play 暂停使用此插件的应用程序 github 问题:github.com/vaenow/cordova-plugin-app-update/issues/146
猜你喜欢
  • 2019-12-03
  • 2021-03-13
  • 2020-02-21
  • 2010-09-08
  • 1970-01-01
  • 2022-11-16
  • 1970-01-01
  • 1970-01-01
  • 2020-11-20
相关资源
最近更新 更多