Forums

OverviewFelgo 2 Support (Qt 5) › onApplicationResumed and OneSignal

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

    filipeagg

    Hello VPlay, I have a small problem

    I use onNotificationReceived signal from One Signal plugin to send the user to the messages Page with popAllExceptFirstAndPush()

    But I also use onApplicationResumed signal to check if the user didn’t open my app for a long time. On that case, I do popAllExceptFirst() and force the user to come back to my initial page.

    As you can see, both handlers are in conflict, being fired onNotificationReceived first, taking the user to the messages app. But right after this signal, applicationResumed is fired and eventually, if the user did not enter my app for a long time the second signal would take the user out of messages Page.

    How can I solve this? Is it possible to cancel applicationResumed signal in this case?

     

    #17922

    Günther
    Felgo Team

    Hi!

    It is not possible to cancel the signal, but you have full control over what to do when the signals fire, right?

    Does it work for you use-case to e.g. set a global property when the notificationReceived is fired, which you can then check in your handler code of applicationResumed to skip the additional popAllExceptFirst() call?

    E.g. somehow like this:

    App {
      id: app
    
      property bool receivedNotification: false
    
    
      OneSignal {
        // ...
        onNotificationReceived: {
          app.receivedNotification = true
    
          // ...
        }
      }
    
      onApplicationResumed: {
        if(receivedNotification)
          app.receivedNotification = false
        else {
         // ...
        }
      }
    }

    Best,
    Günther

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

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support