Android Plugin

Discussion and support for individual OSA plugins
Message
Author
fiveHellions
Posts: 86
Joined: Wed Feb 06, 2013 12:12 pm

Re: Android Plugin

#11 Post by fiveHellions » Fri May 17, 2013 11:57 am

I Made a little progress on integrating with tasker or locale (other phone automation apps may work if they follow the locale standards like tasker does)

It was easier than I thought. I can now set up a tasker task to call a Pattern Match for a namedscript. You could do that before by having tasker send an HTTP Post to the Rest plugin, so it's not a huge breakthrough. But a little easier by just entering the pattern instead of the whole URL every time.

My next steps are to let you enter an object name, method and parameters. And object, property and value. Still things you could do with an HTTP Post though.


Now to really make it better I propose a couple of additions to the REST api.

- get list of patterns so you don't have to type it in and you know what is available on your server
- get a list of object types or containers. That way I have a starting point, then I can get list of objects for that type or container, then list of methods or properties for the object they choose
- possibly get a list of scripts and have the ability to call scripts with parameters from REST api (this would allow you to not have to set up a pattern match every time and also allow you to pass parameters to a script)

this would make setting up actions alot easier for the user and they could choose from a list rather than knowing the script/object/method names off hand

I can do the coding on the REST plugin if everyone thinks there are good additions and don't see any problems with them.


Mat - I gave a little thought to sending an image with the message. It wouldn't be too difficult but the total message size for a Google Cloud Message is 4kb, so we would have to send a URL that links to the image. Because of being limited to two parameters I could either automatically parse out any url in the message or treat it like I do my second parameter and use a comma to separate the message and picture url. Or I could create another method SENDIMAGE and just have the url as the first parameter instead of the message. then that notification would just be a picture without a message.

fiveHellions
Posts: 86
Joined: Wed Feb 06, 2013 12:12 pm

Re: Android Plugin

#12 Post by fiveHellions » Fri May 17, 2013 12:13 pm

Just realized I can pull all objects of type CONTAINER to get list of containers, that list plus the SYSTEM container would let me drill down to any object. So there may not be a need to add the ability to pull list of types or containers to the REST api.

Automate
Posts: 1691
Joined: Sat Dec 11, 2010 1:44 pm
Location: US

Re: Android Plugin

#13 Post by Automate » Fri May 17, 2013 12:51 pm

fiveHellions wrote: - possibly get a list of scripts and have the ability to call scripts with parameters from REST api (this would allow you to not have to set up a pattern match every time and also allow you to pass parameters to a script)
I like this one. In my opinion patterns are for voice recognition. Using them for other purposes just complicates things.

User avatar
bwoodworth
Site Admin
Posts: 1563
Joined: Tue May 04, 2010 6:49 am
Location: California

Re: Android Plugin

#14 Post by bwoodworth » Fri May 17, 2013 1:19 pm

I have no problem with those updates to the REST API if you want to add them in. This is pretty exciting stuff with the android integration.
Brian

fiveHellions
Posts: 86
Joined: Wed Feb 06, 2013 12:12 pm

Re: Android Plugin

#15 Post by fiveHellions » Thu May 23, 2013 12:28 pm

Phone triggers are here.

You can now have events on your phone/tablet/device call patterns matches or object methods in OSA (ability to call scripts will be added later once I add some commands to the REST API)

For this new version I changed the package name of the Android App. So the bad news is you will have to uninstall the previous app and install this new one fresh. Any alert categories that you had set up will have to be recreated. I changed the package name because when I first made it I didn't think and named it like I do all my android apps com.fivehellions.android.projectname. I figured it was better to rename it to something more generic and only associated with OSA since I will probably merge the existing OSA app in soon.

You can download the new apk here. https://dl.dropboxusercontent.com/u/433 ... ension.apk

You must have tasker or locale installed to set up triggers. (If you don't have either and are going to buy one I recommend tasker just because that is what I have and the only one I test against at the moment) If you use a different phone automation program let me know and I can see about making it compatible.

How to set up a trigger using tasker:

1. Open tasker app and click on the "Tasks" tab

2. Click the plus sign at bottom to add a new task, name your task

3. Click the plus sign at bottom to add an action

4. Choose "Plugin" and then choose "OSA Pattern Match" or "OSA Object Method"

5. On the next screen click edit to configure your action

6. For pattern matches enter text that will match one of your patterns, For object methods choose your container, object and method then enter values for your parameters

7. Click the < in the action bar next to icon to save action

7. Now that you have a task created you need to define an event that triggers the task so click the "Profiles" tab

8. Click the plus sign at bottom to add a profile and name it

9. Choose an event type, category and finally the event

10. configure any settings for your event and then click the < in the action bar next to icon to save event

11. now choose the task you created before

That's all there is to creating a basic trigger.

User avatar
bwoodworth
Site Admin
Posts: 1563
Joined: Tue May 04, 2010 6:49 am
Location: California

Re: Android Plugin

#16 Post by bwoodworth » Thu May 23, 2013 1:06 pm

This looks great! I installed it and played around a bit. One thing I noticed was in the Tasker plugin when selecting a container it only lists objects that have the type CONTAINER. I would think it should also list the objects with type PLACE.

Also, are there instructions on how to use the notifications part of the app?
Brian

fiveHellions
Posts: 86
Joined: Wed Feb 06, 2013 12:12 pm

Re: Android Plugin

#17 Post by fiveHellions » Thu May 23, 2013 7:09 pm

I can definitely add objects with type PLACE as well. I currently don't have any place objects so I overlooked that part. My setup is actually very bare bones. Hopefully soon I can get some money set aside to start building out my setup. Currently seeing how smart I can make it before I try and sell my wife on the idea. That's what I love about this project, you can make it as smart as you want. No Limits. If it doesn't do something you want then write a plugin.

For notifications there are some instructions on the wiki page.
http://www.opensourceautomation.com/wik ... le=Android

Let me know if I need to clarify anything about how it works.

fiveHellions
Posts: 86
Joined: Wed Feb 06, 2013 12:12 pm

Re: Android Plugin

#18 Post by fiveHellions » Fri May 24, 2013 7:36 am

New version (0.121) with PLACE objects added along with CONTAINER objects... and of course the SYSTEM object. Let me know if there are any other object types that act as containers.

get it here https://dl.dropboxusercontent.com/u/433 ... ension.apk

I also fixed a bug I saw for methods that you don't pass parameters in. Not sure if it affected if those methods worked or not, but it was throwing an error when the parameter values were null. If anybody was trying to trigger a method without parameters and it wasn't working, this should now be fixed.

And for full disclosure I implemented ACRA (Application Crash Report for Android) in the app. It sends any error messages to a google spreadsheet in my google drive. It doesn't have any personal info except the server address of your osa server. Which if you have it set up for external access would yield your ip address. I could mask that address but its not like any web site you go to doesn't already collect your ip and the only people that will even be able to see this spreadsheet are me and anybody else that wants to collaborate on this app with me. Plus you can always go into the app settings and turn off the error reporting.

Brian - how is the performance when pulling back a big list when setting it up in tasker? I don't have a whole lot of objects so mine is pretty quick.

User avatar
bwoodworth
Site Admin
Posts: 1563
Joined: Tue May 04, 2010 6:49 am
Location: California

Re: Android Plugin

#19 Post by bwoodworth » Fri May 24, 2013 7:49 am

Performance seems pretty good. I don't have a ton of objects in my system either. Great work so far. It really opens up a whole new set of possibilities. Are you planning on merging the app Mat had made? That would really make it a complete app.
Brian

fiveHellions
Posts: 86
Joined: Wed Feb 06, 2013 12:12 pm

Re: Android Plugin

#20 Post by fiveHellions » Fri May 24, 2013 8:01 am

Yes soon I'm gonna combine them.

Have to figure out the best way to have the program flow.

I can either make Mat's screen the main screen and then get to my stuff from a button or menu item (since mine is mostly setup stuff that you won't need to access as often). Or I could add Mat's webview as the first tab in my list of tabs and add the microphone in the action bar with the settings.

Anybody have any thoughts on this?

Post Reply