Notify My Android Integration

 
#1

As discussed in the Twitter topic, I have successfully integrated Notify My Android's (NMA) API in to EZ-Builder through EZ-Script. This will allow push notifications from EZ-Builder to your Android devices for instant remote warnings and information.

To set it up first you must have a Notify My Android account, there are free accounts or for a flat $4.99 fee you can upgrade. Free are fine if you send less than 5 notifications per day but for $5 it's worth upgrading so you don't miss out on anything important.

To do this visit www.NotifyMyAndroid.com
Click on Register
Enter your desired username, password, email address and captcha.

To use the API you will need an API code. Once you have your NMA account and have logged in click on My Account
Next click on Generate Key
You should be given a long key on the page.
User-inserted image

Next, you will need the NMA app on your device(s). It's free from Google Play Store. Click here to get it.

Open up the app and log in with your details - this is straight forward enough and self explanatory.
User-inserted image

User-inserted image

User-inserted image

Now, open up EZ-Builder and load up your project.
Add a new script with the following (you will need to add in your API key)

Code:


$apikey = ""
$event = "Notification"
$description = "Test message sent from within EZ-Builder via EZ-Script commands"
$priority = "0"
$url = "http://www.ez-robot.com";

# Notify My Android call
HTTPGet("https://www.notifymyandroid.com/publicapi/notify?apikey="; + $apikey + "&application=EZ-Builder&event=" + $event + "&description=" + $description + "&priority=" + $priority + "&url=" + $url)



Once you have your API key added to the above code, test the script out by running it. You should receive a notification on your Android devices.

Now you have confirmed it is working edit the script.
Remove lines 2, 3, 4 and 5

Code:


$event = "Notification"
$description = "Test message sent from within EZ-Builder via EZ-Script commands"
$priority = "0"
$url = "http://www.ez-robot.com";



This is now your basic command for sending notifications. To use it, in any script where a notification is needed simply add the following code (fill in the event, description and priority variables to suit the notification). Note: Priority is -2, -1, 0, 1 or 2 with -2 being lowest and 2 being highest.

Code:


# NMA
# Set event and description for the notification
$event = ""
$description = ""
$priority = "0"
$url = ""
# Call the command
ControlCommand("Notify", ScriptStart)



The script should then start the notification script (mine is called Notify), pass the new Event and Description information to the url in the HTTPGet and your Android device(s) should receive the messages.

Use this code in any scripts and, provided you set the $event, $description, $priority and $url variables before running the ControlCommand the message will be tailored to suit the specific trigger or event.

Please ask any questions or ask for anything that is not clear to be clarified where necessary. If it will help I can add images to this to show everything however it shouldn't be necessary.

User-inserted image

User-inserted image

User-inserted image

#2

Reserved for Q&A/FAQ Etc.

#3

Tested and approved !
I just had to change the ControlCommand line because my "Notify" script was in the Script Manager.

It is working great and it is much more efficient than my Dropbox RSS alert.
Thanks for the tutorial.

#4

There is a dropbox plugin for it on the NMA website, I haven't looked at it I just noticed it when I was browsing the apps earlier.

The only downside (currently, however there may be a way) is it wont push images to the device. However, you can send links. It's work in progress still, I'm sure I will want to make it better and easier to use for everyone but it's a start (and so very very flexible, supported by a lot of languages too)

#5

Update: Priority added in. Lowest priority being -2 and highest being 2.

#6

You're an awesome dude Rich!

Thanks for your generous contributions...

#7

I wasn't happy with the tutorial so I just rejigged it all and added more images.

I also added in the url too, this is added after the notification so you can touch it and go to the website, perfect for any "unauthorised access detected" notifications to load up the http server and look at the camera.

#8

You are the man. Just love what you do.

Winky Winky Winky Winky

J

#9

"Rejigged". I love the way you all talk over on the other side of the big pond!

Nice work Rich.

#10

That's really cool Rich. A great demonstration of what the EZB Platform can achieve.