RocketChat / Rocket.Chat.Cordova

Rocket.Chat Cross-Platform Mobile Application via Cordova (DEPRECATED)
MIT License
104 stars 109 forks source link

Gathering push notification project number from GCM-configured RocketChat server #110

Open xenithorb opened 8 years ago

xenithorb commented 8 years ago

Could the client be written in such a way that instead of having to edit the APK, to include the GCM project number, it consumes that from the server when downloading all the other files?

If we're setting it in the server already, why not transmit that number and use it instead of having to edit the client application?

The current instructions are to:

Fill in GCM Project Number in the file www/shared/js/android_sender.js, replace “YOUR-ANDROID-ID-HERE” with your GCM Project Number

Yet, we're already setting that server-side. Could we just read that instead and store it client-side and use that?

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

geekgonecrazy commented 8 years ago

@xenithorb possibly.. Only problem is, I don't think we can pull this off for iOS as well.

xenithorb commented 8 years ago

I understand as much, but for servers like mine where I have chosen not to support iOS anyway, it would be nice to be able to support a more private GCM push messaging without it going through RocketChat's gateway.

As it stands now I think because of the way the docs are written, I think people misunderstand that you need an API key for GCM to work, without realizing that it all goes through your servers.

In addition, it would be nice to support private GCM api keys without having to repackage the app, as the way it stands right now if you fill out the GCM information on the server, in order to use it you must re-package (and redistribute) the app with your account number for it to work (hence the gateway)

I think the way it should work is that if the server is configured with GCM information, the app should prioritize that over using the gateway, but in a clear obvious way to the admin.

xenithorb commented 8 years ago

Some distilled points, the way I understand it is:

  1. If you want people to be able to download and update the app via Google Play (i.e. installing normally) you are forced to use the push gateway https://rocket.chat, because that is the server the google play version is configured for.
  2. If you choose to use your own API keys for GCM, you must re-package the app with the changed information and also redistribute it to your users. <-- This is the problem I'm trying to alleviate by tying the information that is on the server with the app as the user logs in.
geekgonecrazy commented 8 years ago

I get what you are saying. Probably pretty doable.

From an app we distribute though, we have to think of both platforms. We can't just cater to Android because its possible. People then will expect it to work with iOS and it won't.

So this will not solve anything for people.

The push gateway is setup by default for both iOS and Android. From your server you can turn it off if you do not wish to use our gateway. We are doing it as a convenience for our users. If they decide not to use it. That is their choice, we do not hold it against them.

If they wish to run their own, they are free to compile their own apps and use their own GCM / iOS keys. We are more then happy to help people out with this process.

xenithorb commented 8 years ago

I don't see it being a problem with people assuming it will work for iOS if it's a specific checkbox you need to hit underneath the GCM options on the server.

You could also clearly label it with information like "Note: does not affect iOS push settings"

Why not use the GCM settings if available, and continue to send to the gateway for iOS devices?

In my particular case I have a much larger subset of GCM users than iOS, and I as the admin am willing to disclaim on my own server should such a way be possible to route GCM messages and iOS messages separately.

dukemnm commented 7 years ago

Question, if I compile the android app or maybe even the iOS APP how does branding get affected? do i need to rename the app before uploading to itunes or android market?

TheReal1604 commented 7 years ago

@xenithorb I have talked some days before you created this issue with Diego about this. He give us a third solution. -> setup your own push gateway and enter the URL in RC. This could be a helpful thing: https://github.com/Smile-SA/node-pushserver (without reinventing the wheel.) Let's take a private chat at the Demo server about this if you like. (TheReal-1)

RichardFoxworthy commented 7 years ago

@xenithorb @TheReal1604 wondering have either of you found a more foolproof way to manage push notifications for the RC Cordova apps? We are finding the existing setup to be very flaky. We've tried using the default RC gateway and also tried using a custom built Cordova app with custom certs and keys. Neither approach works reliably for us so far - we can get push alerts for some messages but not all when app is open/idle, and we get no push alert at all when app is closed. We do need to support both iOS and Android. The suggestion to try an external gateway such as node-pushserver sounds appealing - have you had success with this?

TheReal1604 commented 7 years ago

@RichardFoxworthy Sry, dont try this push Gateway yet. The push Service from the developers is at the moment enough for my environments.. but in the future i need that also on my enterprise deployment.