【问题标题】:how to generat or create "appcastURL" for upgrader package in flutter?如何在flutter中为升级包生成或创建“appcast URL”?
【发布时间】:2021-03-27 00:43:32
【问题描述】:

我想在 Play 商店或 google play 上提供新版本的应用程序时为用户显示对话框,为此我使用了来自 Flutter 的 Upgrader 包。 这个包使用“AppCast”类。 代码是:

import 'package:flutter/material.dart';
import 'package:upgrader/upgrader.dart';
import 'package:store_redirect/store_redirect.dart';

  void main() => runApp(MyApp());

  class MyApp extends StatelessWidget {
  MyApp({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    // Only call clearSavedSettings() during testing to reset internal values.
    Upgrader().clearSavedSettings();

     // On Android, setup the Appcast.
    // On iOS, the default behavior will be to use the App Store version of
    // the app, so update the Bundle Identifier in example/ios/Runner with a
    // valid identifier already in the App Store.
    final appcastURL =
        'https://raw.githubusercontent.com/larryaasen/upgrader/master/test/testappcast.xml';
    final cfg = AppcastConfiguration(url: appcastURL, supportedOS: ['android']);

    return MaterialApp(
      title: 'Upgrader Example',
      home: Scaffold(
          appBar: AppBar(
            title: Text('Upgrader Example'),
          ),
          body: UpgradeAlert(


            appcastConfig: cfg,
            debugLogging: true,
            showIgnore : false,
            showLater : false,
            dialogStyle :UpgradeDialogStyle.cupertino,
            onUpdate :(){
          _ launchURL();
           return true;
           },

         child: Center(child: Text('Checking...')),
       )),
    );
  }
  _launchURL() async {
    StoreRedirect.redirect(
        androidAppId: "intersoft.pos.soft_ta",
        iOSAppId: "284882215");
  }
}

在示例中 appcastURL 是 'https://raw.githubusercontent.com/larryaasen/upgrader/master/test/testappcast.xml' 如何为我的应用程序获取正确的 .xml 文件?

我阅读了 appcast 类的文档,但我不明白我应该做什么。

【问题讨论】:

  • 创建 xml 文件并将其粘贴到 andymatuschak.org/xml-namespaces/sparkle"> 帮助代码 TJCODE- Appcast 版本 1.15.0 desc2021 年 6 月 8 日星期二 12:00:00 + 0000play.google.com/store/apps/details?id=com.example.app" sparkle:version="1.0.0" sparkle:os="android" />

标签: flutter dart flutter-packages


【解决方案1】:

我发现另一个名为 new_version 的包非常简单明了,不需要任何额外的步骤或自定义。

【讨论】:

    【解决方案2】:

    创建一个新文件appcast.xml

    粘贴进去

    <?xml version="1.0" encoding="utf-8"?>
    <rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
        <channel>
            <title>Help Code TJCODE- Appcast</title>
            <item>
                <title>Version 1.15.0</title>
                <description>desc</description>
                <pubDate>Tue, 08 Jun 2021 12:00:00 +0000</pubDate>
                <enclosure url="https://play.google.com/store/apps/details?id=com.example.app" sparkle:version="1.0.0" sparkle:os="android" />
            </item>
        </channel>
    </rss>
    

    编辑此文件中的详细信息以适应您自己的应用配置。

    将此文件托管在可访问的地方。你可以在 Github 上托管它。

    【讨论】:

      猜你喜欢
      • 2019-05-12
      • 2021-10-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-01
      • 1970-01-01
      相关资源
      最近更新 更多