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

Forums

OverviewFelgo 3 Support (Qt 5) › How to detect my app goes to background?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #22055

    jrrobles79

    Hi, maybe this is a very simple question, but I haven’t found out how to fix it, my app is freezing after an user click on an interstitial (chartboost), and the appstore is open, after that  I go back to my app and is not responding, how do I detect when I leave my app and when I come back, to try and save a state, if an interstitial is clicked. or if there is a way to disable the click of the interstitial? I’m interested on showing ad’s but that the ad’s don’t interrupt the performance of my app.

    #22060

    Gerald

    In your Main.qml file use this code to detect when your app loses or gets focus:

     

    Connections {
           target: Qt.application
           // Qt.application.state:     0 - mimimized
           //                           2 - lost focus
           //                           4 - got focus
           onStateChanged: {
    
                if (Qt.application.state === 0) {
                    
                    console.log("App StateChanged to 'App minimized' (" + Qt.application.state + ")")
                }
                else if (Qt.application.state === 2) {
                    
                    console.log("App StateChanged to 'App lost focus' (" + Qt.application.state + ")")
                }
                else if (Qt.application.state === 4) {
                    
    	      console.log("App StateChanged to 'App got focus' (" + Qt.application.state + ")")
    	  }
          }
    }
    

     

     

Viewing 2 posts - 1 through 2 (of 2 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