Push Notification on Android Phone with Qt



  • Hi,

    I tried this example https://doc.qt.io/qt-5/qtandroidextras-notification-example.html
    but I didn't receive any notification on the phone.
    I am running Qt5.12 and here is my main:

      QQmlApplicationEngine engine;
        NotificationClient *notificationClient = new NotificationClient(&engine);
        engine.rootContext()->setContextProperty(QLatin1String("notificationClient"),notificationClient);
        engine.load(QUrl(QStringLiteral("qrc:/assets/page.qml")));
        engine.addImportPath(QStringLiteral("qml"));
        return app.exec();
    

    And on qml I just do this:

    notificationClient.notification = "Notification!"
    

    Any idea why? Do I need permission?
    Is there also a way to play sound on the notification like an alarm?


  • Lifetime Qt Champion

    Hi,

    What version of Android are you using ?
    Something is not clear, are you experiencing that with the example or with your own application ?



  • @SGaist I am using Android with OS 9 on a Samsung S9 with Qt5.12 and it is on my own application.


  • Lifetime Qt Champion

    What do you mean by own application ? I thought you were using the notification example ?

    Just one thing, your thread title mentions push notifications, this example doesn't implement them.


Log in to reply