← Back to team overview

ubuntu-touch-coreapps team mailing list archive

Re: Push notifications

 

On Sun, 30 Oct 2016 21:42:38 +0300, Roman Shchekin wrote:
> Hi all
>
> I tried to implement push notifications in my app without success. I'm able
> to receive them (notification messages) in my app via PushClient, but I
> system doesn't react - no sound, vibration or bubble. Can someone help me
> with that?

Have you got your app as the active application when you receive a notification? If so then no
system notification is created and instead it just get's delivered to the PushClient.

> I have few issues:
> 1. Seems that my helper (python script) doesn't get control. I do not know
> why, really.

This might be related to the above otherwise check syslog and the helpers upstart log for an indication
as to why it's not being run.

> 2. I do know which example of 'helper output format' is correct, this one
> https://developer.ubuntu.com/en/phone/platform/guides/push-notifications-client-guide/,
> or this one
> https://developer.ubuntu.com/en/phone/platform/guides/push-notifications-server-guide/.
> They are different in "data" sections. In one case it describes
> notification, in another not.

The "data" section can contain anything you want... so all relevant data wrapped up in a json object.
This is the reason for having the helper so you can then craft a postal message with the data that
complies with the helper output format
https://developer.ubuntu.com/en/phone/platform/guides/push-notifications-client-guide/#helper-output-format

If you have control over what's in the "data" section then you can just provide a prepared postal message
and just copy the prepared message over. Which a simple helper like this would be good enough for

```push-helper
#!/usr/lib/initramfs-tools/bin/busybox static-sh
cp $1 $2
```

BR

Dan

--
Sent using Dekko from my Ubuntu device


References