UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Send notification locally from QT/C++/QML App.

    Scheduled Pinned Locked Moved App Development
    21 Posts 3 Posters 812 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • pparentP Offline
        pparent
        last edited by pparent

        Important Note: If I Compile the app with an "Unconfined" apparmor profile I can get notification with libnotify (and not with com.lomiri.Postal), but, it does no make its way to the notification panel in the system tray, and does not trigger any sound or vibration or status LED. It might actually be a temporary solution.

        1 Reply Last reply Reply Quote 0
        • lduboeufL Online
          lduboeuf
          last edited by

          I'm not sure if you can use the indocator message without being unconfined or without using the Postal, or app armor tuning
          Maybe one way to make sure is monitoring dbus (dbus-monitor --session) when a persistant message hppen, it could be a calendar event remnder and see what is happening, which method is called.

          lduboeufL pparentP 2 Replies Last reply Reply Quote 0
          • lduboeufL Online
            lduboeuf @lduboeuf
            last edited by lduboeuf

            i'm not sure also how it works for calendar app ( which is confined app) but there is some push-notification configs there: https://gitlab.com/ubports/development/apps/lomiri-calendar-app
            But the notificzation is not done by the app itself but from the datetime indicator iirc
            https://github.com/AyatanaIndicators/ayatana-indicator-datetime/blob/main/src/notifications.cpp

            1 Reply Last reply Reply Quote 0
            • pparentP Offline
              pparent @lduboeuf
              last edited by

              @lduboeuf

              Thank you but what I don't understand, is the even being unconfined I cannot get it to work by calling Postal via dbus, even when copying dekko code. It only kind of works with libnotify, but does not make its way into the system tray.

              I honestly think the notification system should be way easier for app developers, it's a basic feature.

              lduboeufL 1 Reply Last reply Reply Quote 0
              • lduboeufL Online
                lduboeuf @pparent
                last edited by lduboeuf

                @pparent said in Send notification locally from QT/C++/QML App.:

                @lduboeuf

                Thank you but what I don't understand, is the even being unconfined I cannot get it to work by calling Postal via dbus, even when copying dekko code. It only kind of works with libnotify, but does not make its way into the system tray.

                I honestly think the notification system should be way easier for app developers, it's a basic feature.

                Yes indeed, but popup notification is not the same than indicator messge. the former is based on the freedesktop spec the other is a custom recipe.

                I don't know why it would not work by being unconfined, maybe something to do with the appid ?
                This CLI method seems to do the job

                gdbus call --session --dest com.lomiri.Postal --object-path /com/lomiri/Postal/dekko2_2edekkoproject --method com.lomiri.Postal.Post dekko2.dekkoproject_dekko '"{"message": "foobar", "notification":{"card": {"summary": "yes", "body": "hello", "popup": true, "persist": true}}}"'

                I guess that to work, app need some configs via files like in dekko

                lduboeufL 1 Reply Last reply Reply Quote 0
                • lduboeufL Online
                  lduboeuf @lduboeuf
                  last edited by

                  Also Teleport App use Postal too:
                  https://gitlab.com/ubports/development/apps/teleports/

                  lduboeufL 1 Reply Last reply Reply Quote 0
                  • lduboeufL Online
                    lduboeuf @lduboeuf
                    last edited by

                    I've quickly looked at your repo, you are missing all the config files needed, even if the example is in QML, it shows the config needed https://docs.ubports.com/en/latest/appdev/guides/pushnotifications.html

                    pparentP 1 Reply Last reply Reply Quote 0
                    • pparentP Offline
                      pparent @lduboeuf
                      last edited by pparent

                      @lduboeuf

                      Thank's

                      I've added all the required files:

                      https://github.com/pparent76/whatsweb/commit/4be3c40fa6e692b2c6331dff771f169a829634f2

                      It does not work any better.....

                      Really I don't understand how this can get so insanely complex for something as basic as send a notification... It sure will not help app development on the platform.

                      lduboeufL 2 Replies Last reply Reply Quote 0
                      • lduboeufL Online
                        lduboeuf @pparent
                        last edited by lduboeuf

                        @pparent said in Send notification locally from QT/C++/QML App.:

                        @lduboeuf

                        Thank's

                        I've added all the required files:

                        https://github.com/pparent76/whatsweb/commit/4be3c40fa6e692b2c6331dff771f169a829634f2

                        It does not work any better.....

                        Really I don't understand how this can get so insanely complex for something as basic as send a notification... It sure will not help app development on the platform.

                        Maybe you will write a HowTo and find that was not so complex later 😉
                        The hard part is gathering informations, find the good doc and examples.

                        pparentP 1 Reply Last reply Reply Quote 0
                        • lduboeufL Online
                          lduboeuf @pparent
                          last edited by

                          @pparent
                          Maybe you will need a version bump in your manifest.

                          pparentP 1 Reply Last reply Reply Quote 0
                          • pparentP Offline
                            pparent @lduboeuf
                            last edited by pparent

                            @lduboeuf

                            No but I mean even with good documentation I don't see any reason why you need to create/edit 10 files, with many possibilities to make a mistake, to send a notification.

                            To my mind it should be as simple as something [NOT WORKING EXAMPLES]

                            import Lomiri.Notifications 1.0
                            
                            .....
                            LomiriNotify("title","body");
                            

                            or

                            #include <Lomiri/notifications>
                            
                            .....
                            LomiriNotify("title","body");
                            

                            Possibly changing the apparmor profile, to add a notification profile, but nothing more.

                            lduboeufL 1 Reply Last reply Reply Quote 0
                            • lduboeufL Online
                              lduboeuf @pparent
                              last edited by

                              @pparent said in Send notification locally from QT/C++/QML App.:

                              @lduboeuf

                              No but I mean even with good documentation I don't see any reason why you need to create/edit 10 files, with many possibilities to make a mistake, to send a notification.

                              To my mind it should be as simple as something [NOT WORKING EXAMPLES]

                              import Lomiri.Notifications 1.0
                              
                              .....
                              LomiriNotify("title","body");
                              

                              or

                              #include <Lomiri/notifications>
                              
                              .....
                              LomiriNotify("title","body");
                              

                              Possibly changing the apparmor profile, to add a notification profile, but nothing more.

                              Yes, just someone who need to do that ^ ^, but we have also the confinement model which makes it more difficult. Hope you will find something that fit our needs.
                              Now Qt have made a wrapper for notification, but this doesn't work on our platform yet: https://doc.qt.io/QtApplicationManager/qml-qtapplicationmanager-notification.html#details

                              I don't understand well also all that stuff, especially https://gitlab.com/ubports/development/core/lomiri-push-service/-/blob/main/docs/highlevel.txt#L51 , why an app would need to receive a notification? We just want as you said to send a notification
                              https://gitlab.com/ubports/development/core/lomiri-push-service/-/blob/main/docs/lowlevel.txt

                              pparentP 1 Reply Last reply Reply Quote 0
                              • pparentP Offline
                                pparent @lduboeuf
                                last edited by pparent

                                @lduboeuf said in Send notification locally from QT/C++/QML App.:

                                why an app would need to receive a notification? We just want as you said to send a notification

                                I guess this is push notifications, I.e the remote server sends a push notifications to an app that is suspended, to wake it up, and have it execute some code, because a new event happened server-side.

                                But in practice, as UT is not a widely spread plateform, I guess very few app devellopers have their Own servers, that can send a push notification, like Facebook, Whatsapp, Signal, Instagram, ect... would do. So it seems to me this thing is a good potential tool, that is not so useful in practice for now, at least not as usefull as sending a basic local notification to the notification panel from the app.

                                1 Reply Last reply Reply Quote 0
                                • pparentP Offline
                                  pparent @lduboeuf
                                  last edited by pparent

                                  @lduboeuf said in Send notification locally from QT/C++/QML App.:

                                  @pparent
                                  Maybe you will need a version bump in your manifest.

                                  Done: does not have any effect

                                  https://github.com/pparent76/whatsweb/commit/4c959e0ef8fb8b5e8ca6793d7c116531bd5ea497

                                  Anyway I think I will stay with LibNotify notifications, and see if I can trigger independently some vibration (Haptic). I will need to see how to connect it to Desktop notifications of the whatsapp webview. But now I will make a pause, because I'm tired of this.

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post