2

On ubuntu touch, one can do a 'temporary' notification via 'notify-send'. When I do that it will display a notification for 5 seconds. After that it is gone, and any trace it was ever there with it. This is different behaviour than on the desktop (atleast with kde) where the notification will be displayed and you have a small log of the notifications in the systray.

It is possible to do however, as incoming messages are 'persistent'. With persistent I mean that they are in the notification area on top for review by the user.

What would be the best way to go to create such notifications from a shell scripts. I don't mind creating a binary or script, i.e. the equivalent of notify-send, to do that. Ideally however I would like to use notify-send.

I am using notify-send like this:

notify-send "header" "body"
0

You cannot rely on notify-send, as it is not part of the base image, and not a supported part of the SDK.

The only way to achieve this currently, is to use push notifications, which requires sending the notification to the remote push server, which then disperses the notification to all devices connected with the associated Ubuntu One account.

There are a few types of notifications currently, and push is the only method supported via the SDK. Some redesign of the notifications system is currently happening, and a future version will have a better integrated system with API available in the SDK to use, and will consolidate the current disparity of systems.

I'm not quite sure what you are trying to do exactly, but the application lifecycle and confinement in the phone and tablet images does not work in a way consistent with what you seem to be doing.

  • Thank you. This is for my private phone thus not for an official app. I have for the desktop a simple shell script which occasionally outputs a notification. But I do like to review those when I look at my phone. – luctius Apr 9 '16 at 14:20
0

Have you tried changing the --expire-time=TIME property of the notification? I believe that can be changed to a higher value like 10,000 (in ms).
Further detailed information can be found here

  • Yes I have, but there was no change. – luctius Apr 13 '16 at 9:07
0

To push the notification to the list of persistent notifications, you don't push a notification, but you instruct the "indicator-messages" to do it, then the little envelope indicator turns green and you have your notification in pending notifications also. You have to do this:

  • Create an application that has a "push-notification-client" right.

  • In that application you will want to send a DBus message to com.ubuntul.Postal with your message.

Because maybe you just want a hack (like me). You can do:

  • Install the twitter webapp from publisher Canonical Group Limited, from the app store.

  • From terminal or a ssh session you run:

gdbus call --session --dest com.ubuntu.Postal \
--object-path /com/ubuntu/Postal/com_2eubuntu_2edeveloper_2ewebapps_2ewebapp_2dtwitter \
--method com.ubuntu.Postal.Post \
com.ubuntu.developer.webapps.webapp-twitter_webapp-twitter \
"\"{\\\"message\\\": \\\"foobar\\\", \\\"notification\\\":{\\\"card\\\": {\\\"summary\\\": \\\"Some Title\\\", \\\"body\\\": \\\"Some text\\\", \\\"popup\\\": true, \\\"persist\\\": true}}}\""

This hack was found in the testing of the "indicator-messages" page here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.