Felgo 2.12.2 adds support for Realtime Database Listeners to the Firebase Plugin, which allows your app to get notified whenever your data changes. In addition, the recently improved Qt Creator Designer now comes with icons for all Felgo types to let you distinguish the different components more easily.

Felgo 2.12.2 comes as a free update for all Felgo developers.

Firebase Realtime Database Listeners

Use the Firebase Plugin to store and sync data in realtime across all clients with the Firebase NoSQL Cloud Database.

update-2122-firebase-database-data

The Firebase Realtime Database is a cloud-hosted database. Data is stored as JSON and changes to the database are propagated to other clients in real time. This update adds new properties and signals to the FirebaseDatabase item, which you can use to add listeners for certain database entries. With the Firebase Realtime Listeners, your app is notified immediately after your data in the cloud gets changed – no matter which device, user or application changed the value.

The following example uses the FirebaseDatabase::realtimeValueKeys property and FirebaseDatabase::realtimeValueChanged() signal to keep track of a public database entry newstext:

import Felgo 3.0

App {

FirebaseDatabase {
realtimeValueKeys: ["public/newstext"]
onRealtimeValueChanged: {
if(success) {
console.debug("Public Realtime Value '" + key + "' changed to '" + value + "'")

// if newstext got changed -> update AppText to show news
if(key === "newstext")
news.text = value
}
else {
console.debug("Error with message: " + value)
}
}
}

AppText {
id: news
text: "" // no news by default, news is loaded from database and always up-to-date
}
}

This example already shows how powerful the new Firebase Realtime Listeners can be. As soon as the newstext entry changes in the database, all clients will get notified and replace the old news. As Firebase also supports authentication and user access rules, you could even create a real-time chat with this new feature.

 

Firebase Realtime Database vs. Felgo WebStorage

Felgo also comes with its own easy to use WebStorage, which connects to the Felgo backend hosted on Amazon servers (and also available on-premise for Enterprise Customers). It is a simple key-value store which syncs across different devices and platforms via the Felgo Game Network Backend as a Service (BaaS).

So what’s the difference between Firebase and Felgo Cloud Storage?

Felgo WebStorage has these advantages compared to FireBase:

  • All platforms: Felgo WebStorage works not only on iOS & Android, but on all supported Felgo platforms. This also includes Desktop and embedded systems.
  • No authentication required: With Felgo WebStorage, you can access per-user data without your users having to log in.
  • Late authentication: Your users can authenticate later but start saving user data before this authentication. Once they do authenticate, their data is kept and merged to the new user profile.
  • Advanced merge conflict management: With Felgo WebStorage, you can modify the default merge conflict rules that may occur if your user stores to the same key from multiple devices at the same time. In Firebase, the last write is used, whereas in Felgo a merging of the data is tried first. Additionally, you can customize the merge behavior to your requirements with the WebStorage::dataConflictStrategy property.

These are the same features like Firebase has:

  • Offline usage: You can write and read values from the storage even if the user is offline. As soon as the user has Internet Connection again, the locally cached data is synchronized with the cloud.
  • Data synchronization: If the same user is authenticated on multiple devices, a change in the data is forwarded to all connected devices in realtime. This way, the user has the same data across all devices, even across platforms.

There is one restriction with WebStorage though: user access rights. With Felgo WebStorage, there are 2 access rules: per-app and per-user data. The per-user data cannot be shared with other users, and the per-app data cannot restrict its access to certain users. You can work around this restriction by adding custom fields to your per-app data that specifies to which user the app-wide data shall be available for. However, if you have advanced requirements for user rights & data management, the Firebase Realtime Database is the better solution as you can define access rules comprehensively.

For a quick summary: if you are looking for a simple key-value store in the cloud that gets synced to multiple devices, you are better off with the Felgo WebStorage.

 

Note: If you want to build a social messaging app, a chat app, or any application where you’d like to allow your users to become friends with each other, user authentication and send messages, the Felgo Backend (using Game Network + Multiplayer functionality) is an option you can use! It features a friend system, realtime chat with push notifications, cloud storage, and more. Contact us here if you’d like to have a demo project using all these features.

 

Qt Quick Designer Icons

Since Felgo 2.12.1, it is possible to use Felgo Components with the improved Qt Quick Designer of Qt Creator 4.3. To help you get more out of the designer and quickly find the components you need, this update adds icons for all items available with the Qt Quick Designer:

update-2122-designer-icons

For a quick guide how to use the new Qt Quick Designer with Felgo, have a look at our tutorial video:

Learn more about the Qt framework. Get training or outsource your Qt app development with Felgo’s team if you need help with that.

How to Update Felgo

Test out these new features by following these steps:

  • Open the Felgo SDK Maintenance Tool in your Felgo SDK directory.
  • Choose “Update components” and finish the update process to get Felgo 2.12.2 as described in the Felgo Update Guide.

Felgo Update in Maintenance Tool

If you haven’t installed Felgo yet, you can do so now with the latest installer from here. Now you can explore all of the new features included in Felgo 2.12.2!

 

 

More Posts Like This

How to Make Cross-Platform Mobile Apps with Qt – Felgo Apps

How to Make a Qt app

Release 2.11.0: All Monetization Plugins Now Free, Plugin Trial & Firebase Qt Plugin

Release 2_11

WeAreDevelopers Conference App – Open Source & Live Now!

WeAreDevelopers