galadril / DomoticzForAndroid

This is a Domoticz Android app. Domoticz is a very light weight home automation system ...
http://www.domoticz.com
14 stars 7 forks source link

Push Notifications from Domoticz #72

Closed galadril closed 5 years ago

galadril commented 8 years ago

Implement Push Notifications from Domoticz system to the Android app! https://developers.google.com/cloud-messaging

This also requires someone to implement Android push notifictions on the Domoticz side...

pushnotifications

RoadXY commented 8 years ago

Jeej, an milestone! But, great idea! Hopefully someone of the server devs is willing to participate on this.

galadril commented 8 years ago

Nice tutorial/description: https://github.com/codepath/android_guides/wiki/Google-Cloud-Messaging

So the app needs to register on the Google Connection servers, then we need to save that token in Domoticz.

curl -s "https://android.googleapis.com/gcm/send" -H "Authorization: key=[API_KEY_HERE]" -H "Content-Type: application/json" -d '{"to": "[REG_TOKEN_HERE]", "data": {"messages": "text"}}'

Looks not to hard..

RoadXY commented 8 years ago

Have been worrying about all the api keys being readable (since both Domoticz server and Domoticz Android client are open source) and found this:

http://stackoverflow.com/questions/32827977/can-i-share-google-cloud-messaging-api-key

galadril commented 8 years ago

Or use environment variables in Android Studio for secret things http://en.wikipedia.org/wiki/Environment_variable

If they get the branch, they get a question to setup the environment variable (so they need to create a key for their own..)

I think we should still do that for the Geofence api key :)

RoadXY commented 8 years ago

http://www.rainbowbreeze.it/environmental-variables-api-key-and-secret-buildconfig-and-android-studio/

Nice find! Going to use this for my other projects to!

acmkonings commented 5 years ago

As of April 10, 2018, Google has deprecated GCM. The GCM server and client APIs are deprecated and will be removed as soon as April 11, 2019. Migrate GCM apps to Firebase Cloud Messaging (FCM), which inherits the [..] GCM infrastructure. Migration documentation is available.

galadril commented 5 years ago

This is an old repo.. we're using FCM already