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


OverviewFelgo 3 Support (Qt 5) › Count number of app starts

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #21935



    I need to count the number of app starts, as only on the first launch do I need my users to agree to the privacy policy/terms of service! I found on;




    the section of:

     import Felgo 3.0
     import QtQuick 2.5
     App {
       // define Storage item for loading/storing key-value data
       Storage {
         id: localStorage
         property int appStarts: 0
         // update app starts counter
         Component.onCompleted: {
           var nr = localStorage.getValue("appstarts")
           if(nr === undefined)
             nr = 0
           localStorage.setValue("appstarts", nr)
           appStarts = nr
       // define page that shows nr of app starts
       NavigationStack {
         Page {
           id: page
           title: "Local Storage"
           AppText {
             anchors.centerIn: parent
             text: "App Starts: "+localStorage.appStarts

    and have added to my main.qml, but I still get the popup each time my users launch the app?

    the visibility of the item I want show/hide is on a separate page, loginPage.qml, and the visibility is:


    Item {
            id: termsAccept
            visible: localStorage.appStarts > 1 ? false : true
            enabled: localStorage.appStarts > 1 ? false : true


    WHat could I change to sort this?


    Thanks 🙂


    Felgo Team

    Hi Edward,

    do you see no issue in the log output? From the code you posted, there is nothing suspicious jumping to my eye. Does the text display the correct value for the number of app starts?




    Hi Alex,

    It was not counting as the popup showed on every launch, however I found another example on the storage page which uses a Boolean flag which works as intended!


        Storage {
            id: myLocalStorage
            Component.onCompleted: {
              var isFirstStartApplication = myLocalStorage.getValue("firstStart")
              if(isFirstStartApplication == undefined) {
                applicationFirstStart = true
              myLocalStorage.setValue("firstStart", true)


Viewing 3 posts - 1 through 3 (of 3 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded