Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

VersionCheckLoader

Provides a convenient way to check if an updated version of your app is available. More...

Import Statement: import Felgo 4.0
Inherits:

Item

Properties

Detailed Description

You can use this utility to check against a web server whether a newer version of your application is available.

This utility loads a QML source file specified by the source property. This file contains the actual version check logic and any UI that is displayed to the user in the case when a newer version is available. You can use the VersionCheckDialog convenience component to help with this task or use custom QML code to perform the version check and display a message to the user.

You can add the VersionCheckLoader item as a direct child of the root App item. The z property is set to 1 by default in order to place the version notification UI on top of other UI components.

Note: The actual version checking script needs to be hosted on your web server.

Note: VersionCheckLoader only checks against the source URL in publish builds. This behavior can be overridden using the active property.

Example Usage

Following example demonstrates the usage of the VersionCheckLoader and VersionCheckDialog components:

Place the following code in your application Main.qml file:

 import Felgo
 import QtQuick

 App {
   id: app

   AppPage {
     // ... UI items go here ...
   }

   // Place the VersionCheckLoader item as the direct descendant of the App item
   // and set the 'source' property accordingly.
   VersionCheckLoader {
     source: "https://mydomain.com/myAppVersionCheck.qml"
   }
 }

Place the following code in myAppVersionCheck.qml file.

Specify the version codes accordingly. You can specify different version codes for each platform as your release cycle might differ between platforms. In similar fashion, for each platform specify URL links where the user can obtain the new version. This can be a link to the application app store page.

 import Felgo
 import QtQuick

 VersionCheckDialog {
   latestVersionCodeIOS: 114
   latestVersionCodeAndroid: 116

   updateUrlIOS: "https://itunes.apple.com/at/app/id1157319191"
   updateUrlAndroid: "https://play.google.com/store/apps/details?id=net.vplay.apps.QMLLive"

   dialogTitle: qsTr("Update Available")
   dialogText: qsTr("A new version is out! Update now?")
 }

Note: This file (myAppVersionCheck.qml) is not part of your application build. You need to deploy it to a web server so it is accessible via the URL that is specified as the VersionCheckLoader::source property, in this case: "https://mydomain.com/myAppVersionCheck.qml". You will need to update this file with the latest version codees whenever you release a new version of your app.

In case a newer version is available, the VersionCheckDialog shows the following message. If the user clicks 'OK', they will be taken to the specified URL.

The version check is performed and the dialog is shown as soon as the remote QML file is loaded.

Alternatively, you can use your own custom QML code instead of the VersionCheckDialog component and display any custom UI and perform any custom logic. Within your custom code, you can access the current version of the installed application using the system.appVersionCode context property and the platform using the system.platform context property.

Note: Remember that you can only use such QML and Felgo components and features in your custom version checker QML file that are already supported in the oldest deployed version of your app that might check for newer versions.

See also VersionCheckDialog.

Property Documentation

active : bool

This property specifies whether the version check script is actually loaded or not. The value of this property is by default set to system.publishBuild. This default behavior prevents needless checks during app development.


source : string

URL to the version check script that is hosted on your web server.

This file performs the actual version check logic and displays any messages to the user.

You may use the VersionCheckDialog component to conveniently handle this task.

Or alternatively, you can use your own custom QML code instead and display any custom UI and perform any custom logic. Within your custom code, you can access the current version of the installed application using the system.appVersionCode context property and the platform using the system.platform context property.

Note: Remember that you can only use such QML and Felgo components and features in your custom version checker QML file that are already supported in the oldest deployed version of your app that might check for newer versions.


Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded