• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[APP][2.2+][UPDATED 08/23/12] SnapNotify - Roll Your Own Custom Cloud Notifications

Search This thread

sagarkar

Member
Aug 20, 2012
37
26
SnapNotify – Roll Your Own Custom Cloud Notifications
What’s the point?
SnapNotify makes getting cloud-based android notifications as easy as posting to a webserver – and the entire system (including running your own server) is free!

How does it work?
SnapNotify consists of a lightweight server (powered by node.js, which you can run for free on heroku) and an android app that handles receiving notifications. It allows you to push custom notifications to all of your mobile devices, without having to learn Google Cloud Messaging or having to write your own android app.

Sample use:
Code:
$ curl -d "Test Message,SnapNotify works. yay : )" "http://YOURSERVER/message"

Produces a notification on all of your devices that looks like this:
SnapNotifyScreenshot-small.png


Some Simple Use Cases:
1) A simple web scraper / monitor
- Write a script that loads a page, checks content, and notifies you upon changes
- Offloads the heavy lifting to your server

2) Server tasks
- Just tag a POST onto the end of your management scripts to be notified when time-consuming events complete

Basically, the idea is to make it easy to incorporate GCM messages / notifications into hacks that don't need an independent and full-fledged Android App.

Installation / Setup:
I've written a full setup guide with download links and source on my website, which you can find here:
http://sagark.org/snapnotify-roll-your-own-custom-cloud-notifications/

Post here if you have ideas for improvement / find it useful / etc. :D
 
Last edited:

sagarkar

Member
Aug 20, 2012
37
26
  • Like
Reactions: woot_galaxy_nexus

psouza4

Inactive Recognized Developer
Feb 26, 2009
746
856
Meridian, ID
www.PeterSouza.com
Looks good so far... but you knew this question would come up:

How do we customize notifications (different icons, different sounds, launch a custom intent on click -- maybe encoded in the notification itself, etc.)? Do you have something coming to the APK and/or source code for it?

Thanks!
 

sagarkar

Member
Aug 20, 2012
37
26
Looks good so far... but you knew this question would come up:

How do we customize notifications (different icons, different sounds, launch a custom intent on click -- maybe encoded in the notification itself, etc.)? Do you have something coming to the APK and/or source code for it?

Thanks!

Yep, this'll probably come as something encoded in the POST + predefined settings (key, values) in the app. Unfortunately, school starts tomorrow so I don't have a ton of time on my hands anymore :(

I'll try to get it done soon though.
 

sagarkar

Member
Aug 20, 2012
37
26
Update Aug 23, 2012:
For those of you running on heroku, snapnotify-server now posts to itself every 20 minutes to prevent idling. Idling wouldn't be a problem by itself, but heroku provides a read-only fs (thus no storing to registration_store), so you'd need to re-register after every recovery from idle. Preventing the idling seems to be the simplest solution at this point. After updating, everything should work as expected. Nothing should change for anyone running on their own server.

Upgrade paths:
1) Running on heroku:
Server: Obtain the new files, change settings in snapserver.settings, git add -u, git commit -m 'update', git push heroku master
App: No need to update

2) Your own server:
Server: Stop Node.js, obtain new files, change settings in snapserver.settings (notably, change the new heroku attribute to false), restart Node.js
App: No need to update
 
  • Like
Reactions: mewantnexus7

psouza4

Inactive Recognized Developer
Feb 26, 2009
746
856
Meridian, ID
www.PeterSouza.com
Wound up writing my own app and ditching node.js for something that'll run on a traditional webserver. I'm not that patient and wanted to customize a bunch of stuff. Thanks for the great idea/work so far!
 
Last edited:

snoopy33

Senior Member
Nov 27, 2005
1,497
2,633
Hi,

I want to integrate your code to my app, I don't find the Android source code. Will you release it? Is it opensource?

Thank you for your help.
 

Atarii

Senior Member
May 10, 2011
734
654
Followed the heroku guide. Using the curl example I always see this error in my heroku logs:

{ messageId: undefined,
canonicalRegistrationId: undefined,
errorCode: 'MismatchSenderId' }

I've tried creating a registration_store containing the long string (seen when I registered from the Android app), but same error.

Any suggestions to getting this to work?

Edit: Got it working! :D I had my Sender ID wrong. Thanks for the great guide!
 
Last edited:

sagarkar

Member
Aug 20, 2012
37
26
Hi,

I want to integrate your code to my app, I don't find the Android source code. Will you release it? Is it opensource?

Thank you for your help.

I'm planning on open-sourcing it once I get time to rip out admob (the revenue from ads vs having this open source, open source wins :p ) and clean up the code. Unfortunately, school has started so I don't have much free time.
 

jmaciak

Senior Member
Aug 27, 2009
108
25
I'm planning on open-sourcing it once I get time to rip out admob (the revenue from ads vs having this open source, open source wins :p ) and clean up the code. Unfortunately, school has started so I don't have much free time.

Well once you open source it, the community can do it for you :)

Sent from my GT-I9300 using Tapatalk 2
 

soulcrusher

Senior Member
Apr 12, 2007
213
12
I cant seem to get a notification to my device.
I followed the setup on your site and managed to get it up, but when I browse to my heroku address I get this:
Welcome to snapnotify-server! Your server is now running at: YOUR_SERVER_ADDRESS:45961
I entered the correct settings in the config file, but when I enter the example, curl -d ..., I get a log in heroku saying Invalid request: 401 and syntaxerror: Unexpected token
I have changed the URL in the snapserver.settings, but I'm sure it is supposed to say the actual address?
 

sagarkar

Member
Aug 20, 2012
37
26
I cant seem to get a notification to my device.
I followed the setup on your site and managed to get it up, but when I browse to my heroku address I get this:

I entered the correct settings in the config file, but when I enter the example, curl -d ..., I get a log in heroku saying Invalid request: 401 and syntaxerror: Unexpected token
I have changed the URL in the snapserver.settings, but I'm sure it is supposed to say the actual address?

Are you sure you committed and pushed after changing the settings? Also, make sure you don't include http:// in the url in snapserver.settings
 

Top Liked Posts

  • There are no posts matching your filters.
  • 16
    SnapNotify – Roll Your Own Custom Cloud Notifications
    What’s the point?
    SnapNotify makes getting cloud-based android notifications as easy as posting to a webserver – and the entire system (including running your own server) is free!

    How does it work?
    SnapNotify consists of a lightweight server (powered by node.js, which you can run for free on heroku) and an android app that handles receiving notifications. It allows you to push custom notifications to all of your mobile devices, without having to learn Google Cloud Messaging or having to write your own android app.

    Sample use:
    Code:
    $ curl -d "Test Message,SnapNotify works. yay : )" "http://YOURSERVER/message"

    Produces a notification on all of your devices that looks like this:
    SnapNotifyScreenshot-small.png


    Some Simple Use Cases:
    1) A simple web scraper / monitor
    - Write a script that loads a page, checks content, and notifies you upon changes
    - Offloads the heavy lifting to your server

    2) Server tasks
    - Just tag a POST onto the end of your management scripts to be notified when time-consuming events complete

    Basically, the idea is to make it easy to incorporate GCM messages / notifications into hacks that don't need an independent and full-fledged Android App.

    Installation / Setup:
    I've written a full setup guide with download links and source on my website, which you can find here:
    http://sagark.org/snapnotify-roll-your-own-custom-cloud-notifications/

    Post here if you have ideas for improvement / find it useful / etc. :D
    2
    Looks good so far... but you knew this question would come up:

    How do we customize notifications (different icons, different sounds, launch a custom intent on click -- maybe encoded in the notification itself, etc.)? Do you have something coming to the APK and/or source code for it?

    Thanks!

    Yep, this'll probably come as something encoded in the POST + predefined settings (key, values) in the app. Unfortunately, school starts tomorrow so I don't have a ton of time on my hands anymore :(

    I'll try to get it done soon though.
    1
    Sorry for the double post, but quick question: If I already have a domain name and stuff, is there a way that I can point it to the heroku server so that I don't have to remember the long subdomain? Thanks

    Yep, Heroku supports this functionality. You can follow the guide at the top of this page and then setup a CNAME in your DNS:
    https://devcenter.heroku.com/articles/custom-domains
    1
    Update Aug 23, 2012:
    For those of you running on heroku, snapnotify-server now posts to itself every 20 minutes to prevent idling. Idling wouldn't be a problem by itself, but heroku provides a read-only fs (thus no storing to registration_store), so you'd need to re-register after every recovery from idle. Preventing the idling seems to be the simplest solution at this point. After updating, everything should work as expected. Nothing should change for anyone running on their own server.

    Upgrade paths:
    1) Running on heroku:
    Server: Obtain the new files, change settings in snapserver.settings, git add -u, git commit -m 'update', git push heroku master
    App: No need to update

    2) Your own server:
    Server: Stop Node.js, obtain new files, change settings in snapserver.settings (notably, change the new heroku attribute to false), restart Node.js
    App: No need to update