← Back to team overview

ubuntu-phone team mailing list archive

Re: If Gmail can, why other apps can't?

 

On 12 September 2015 at 16:03, Krzysztof Tataradziński <ktatar156@xxxxxxxxx>
wrote:

>
> So if I good understand, that Gmail is asking Ubuntu OS and sending some
> data to Google and get some other back, even when primary app is closed?
> Yes?
>

So, the gmail, facebook, and twitter notifications are notionally separate
from the pre-installed web apps at the moment.  The account-polld process
just checks for relevant accounts registered on the system, and then
periodically calls those services' APIs and then injects notifications
locally.

As I said before, account-polld is not extensible by apps.  So they are
encouraged to instead use the push notifcation service.  With this, your
app would contact a server you're running and ask for notifications to be
sent.  When there are notifications for the user, your server would then
make the appropriate requests to Canonical's push notification server.
That server would then contact the user's phone, which will in turn call
your app's push notification helper.  At that point you can inject a
notification message, or whatever else.


> I'm thinking about Activity Tracker - is there a possibility to do similar
> thing with GPS data? I mean that app will ask Ubuntu OS for location, even
> when screen is off (and app is not in foreground) - is that possible for
> now or does Canonical working on it?
>

The push notification API isn't going to help with GPS, since you want to
be woken based on a local event rather than something coming over the
network.  I don't think such an API is available for location yet.  I
rememeber seeing some talk about the possibility of a "geofence" style API
(where a helper could be invoked if the user moves more than a certain
distance), but I don't know if it has gotten beyond the idea stage.

James.

References