Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add push notifications (for when app in background) #5

Open
bittner opened this issue Sep 2, 2015 · 21 comments
Open

Add push notifications (for when app in background) #5

bittner opened this issue Sep 2, 2015 · 21 comments

Comments

@bittner
Copy link

bittner commented Sep 2, 2015

At the moment Hangups doesn't notify a user about new incoming messages. That's partly because an application falls asleep as soon as it goes into the background. Push notifications are needed to address this problem. Without push notifications any messaging app makes only limited sense. (Users will complain soon.)

The Ubuntu push notification framework provides a server-side API to deliver notifications to registered clients regardless of whether the app is active or even started. When a push notification arrives the notification control would activate the app (when the user clicks on a notification).

References

Some findings from a (rather superficial) research:

@StuntsPT
Copy link

+1, just so I can track this. I'm interested in helping implement this.

@timsueberkrueb
Copy link
Owner

As much as I liked that I fear that this isn't possible right now.
The problem is: for real push notifications I would need a server which leads too privacy concerns and thus a great responsibility (and not to forget the server costs). That's out of the range of this project.
I hope that there will be a way for Ubuntu Touch apps to run in background to check for messages, maybe using a routine which is called every minute. We'll see whether there will be a way in the future.

@StuntsPT
Copy link

What about as an alternative, create an indicator that polls for messages every "X" seconds?
I have found some hints on this (https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators), but I'm not even sure it works on ubuntu touch (seems like so but I'm not 100% sure).
The API example is for python so it should not be a stretch...
Here's some more information (once again, desktop focused, but it should be the same API) http://askubuntu.com/questions/158323/how-do-i-create-a-working-indicator-with-qt-c
And this is also probably relevant:
https://launchpad.net/sni-qt

Do you think this is a possible way to go?

@tdryer
Copy link

tdryer commented Sep 16, 2015

The problem is: for real push notifications I would need a server which leads too privacy concerns and thus a great responsibility (and not to forget the server costs). That's out of the range of this project.

In addition to those problems, Google would probably block having too many different accounts using Hangouts from one IP. You'd have to let users self-host the server component.

@bittner
Copy link
Author

bittner commented Sep 16, 2015

Canonical currently polls Google servers already. Maybe their server already queries the online status, or we could ask them to also poll it? It's an interim solution for Canonical, so maybe they let us use it too.

Read more at "If Gmail can, why other apps can't?" on the ubuntu-phone mailing list.

@timsueberkrueb
Copy link
Owner

@StuntsPT yeah, that's what I like to do but currently there's no way for apps to run in the background on Ubuntu Touch.

@StuntsPT
Copy link

Humm... I was under the impression (I could be completely wrong, though) that if an app was on the indicator it did not get backgrounded (eg. networkmanager).
I'll try to research this better tonight and report back.

@timsueberkrueb
Copy link
Owner

@StuntsPT well, I don't think you can use this desktop-style indicators on Ubuntu Touch (or at least I haven't seen yet something like this :)). If it'd be possible, this wouldn't solve the problem, the app would probably still get suspended when it has no active focus.

@StuntsPT
Copy link

So, after researching this topic, here's what I have figured:

  1. What I was mentioning (an indicator app, that would keep some daemon from the application in the foreground) was proposed at some point to include in the SDK, but it never made it.
  2. At this point, two alternatives seem to exist:
    2.1. Push notifications - this is what canonical recommends, but requires a dedicated server;
    2.2. account-polld daemon. This service is used by canonical to query google, twitter and facebook (at least) and push the notifications to the phone. Hangouts is a very popular app, so, if asked nicely, and since they already query google services, they might accept adding hangups to their daemon. I'll see if I can look at this code and figure out if it at least can be done. If it is possible then I think asking them to push that further info is at least worth a shot.

@StuntsPT
Copy link

This might also be relevant:
https://bugs.launchpad.net/dekko/+bug/1421923

"Dekko", and email client also had issues with notifications. We can try to solve it the same way they do...
https://plus.google.com/101390620047921378812/posts

Yup, Dekko is using account-polld

@timsueberkrueb
Copy link
Owner

@StuntsPT thanks for your research. account-polld might be a possibility. I think they stated that it's just meant as an interim solution though.

@StuntsPT
Copy link

You're welcome!
Yes, it's in interim solution... until google eventually support the Ubuntu push notifications system.
When/if that happens, switching to push notifications should be rather trivial.

@timsueberkrueb
Copy link
Owner

@StuntsPT will this ever happen? 0.0

@StuntsPT
Copy link

I think it's too early to tell.
Ubuntu touch is doing better than most have anticipated, but not as well as the most optimistic predictions.
If it does happen it will be in the long term - most likely longer than the life expectancy of our current phones. xD

@timsueberkrueb
Copy link
Owner

@StuntsPT yep agree, I doubt this will happen at all. Unless @google turns out to be super awesome :)

@StuntsPT
Copy link

@tim-sueberkrueb look here. Get this number up 100 fold and it might just happen. But that's OT.
Tonight I'll research the use of account-polld and see where that leaves us.

@StuntsPT
Copy link

@tim-sueberkrueb I think this should be what we need:
http://bazaar.launchpad.net/~nikwen/account-polld/imap-mails/view/head:/plugins/gmail/gmail.go
I did not go deep into it... how much would it need to be modified to get hangouts notifications?
Maybe @tdryer could provide us with a hint on this?

@tdryer
Copy link

tdryer commented Sep 17, 2015

I did not go deep into it... how much would it need to be modified to get hangouts notifications?

You'd have to port some things to Go, but for simple polling all you'd need is a stripped-down hangups.Client, which should be pretty simple.

@StuntsPT
Copy link

@tdryer Thanks! I'll take a stab at that during the weekend if I have the chance.

Also, @tim-sueberkrueb look here:
http://nikwen.github.io/ubuntu/2015/09/17/my-work-on-email-notifications.html
Notification problem and (possible) solution explained in detail.

@dobey
Copy link

dobey commented Jan 22, 2016

You cannot install a plug-in for accounts-polld in an application package, so that is not an option. The accounts-polld will also go away when the services it currently has plug-ins for get push notifications. The only plug-in being used in accounts-polld now I think is for Twitter.

@timsueberkrueb
Copy link
Owner

@dobey ok, what about GMail notifications? Well, yeah, this would've required cooperation with Canonical or publishing it to the open store. That wouldn't be optimal of course :| I'd really like to see a proper solution for background processing from Canonical's side for this.
See https://bugs.launchpad.net/ubuntu-application-lifecycle/+bug/1532221.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants