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

Forums

OverviewFelgo 3 Support (Qt 5) › oneSignal in my QtWidget based application

Tagged: 

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

    Marek

    Hi,

    I need to integrate oneSignal into my old QtWidget based application and I could use some help.

    I have added qml and quick to Qt modules and v-play to CONFIG.

    I have also added this to my main.cpp

    VPApplication vplay; // 2 - create VPApplication instance
    QQmlApplicationEngine engine;
    vplay.initialize(&engine); // 3 - initialize Felgo
    engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));

    in main.qml there is:

    App {
    
        licenseKey: "MYKEYYYY"
    
        visible: false
        id: main_app
    
        OneSignal {
            id: onesignal
    
            logLevel: OneSignal.LogLevelVerbose
            appId: "MY_APP_ID"
            googleProjectNumber: "MY_GOOGLE_PROJECT_ID"
    
            onNotificationReceived: {
                console.debug("Received notification:", message, JSON.stringify(additionalData), isActive)
                // Possible actions:
                // - Read message from data payload and display a user dialog
                // - Navigate to a specific screen
                // - ...
            }
            onTagsReceived: {
                var tagStr = ""
                for(var tag in tags)
                    tagStr += tag + " = " +tags[tag]
    
                if(tagStr != "")
                    tagStr = "Current tags: "+tagStr
                else
                    tagStr = "Current tags: no tags set"
    
                listModel.setProperty(5, "name", tagStr)
            }
            onUserIdChanged: {
                console.debug("Got OneSignal user id:", userId)
            }
        }
    }

    It works and I can receive notifications, but apparently this is not the way to go because my QtWidget based application now has some issues with main window, resolution is not set correctly or there is alway white strip at the bottom of the application.

    Could you point me to some solution.

    Best Regards

    Marek

    #17183

    Günther
    Felgo Team

    Hi Marek,

    Did you also have a look at the post How to Add Felgo to your Qt Mobile App for a guide about integrating Felgo? For example, if you want to create / manage your own application window instead of using App { }, you can do so by adding a GameWindowItem.

    Regarding your issue: I assume the problem you are describing is not related to the OneSignal plugin – or does this only happen when you actually have the OneSignal item in your code?

    If you already tried different solutions as described in the post, can you compose a minimum example project that shows the issue? Please send the project to support@felgo.com so we can have a quick look at the app initialization, window setup, etc…

    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.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded