Open RolfHut opened 10 years ago
I'd recommend interfacing directly with the Spark Core Rest API rather than trying to use this project as a base. You could use a library like Retrofit to quickly build out the API interface for Android.
http://square.github.io/retrofit/ http://docs.spark.io/api/
I've been meaning to do something similar for one of my own projects. I'll post code to my GitHub account when I get something up and running.
Hi blackcj,
I use this app as a base for two reasons:
My main concern (after another night of hacking, learning and searching on stackOverFlow) is that ApiFacade.java is really geared toward the tinker firmware running on the Core. I would like for that to change into two files: one with the general ApiFacade and one with all the tinker implementation. I am working on that, but since I am not a pro-andriod dev, I guess my ducttape-y solution will not be up to standard to merge into this repo. Will publish whatever I did though. Any help is much appreciated, mainly in handling the receiver side.
Hi all,
I made two versions of this app:
I have two questions:
If questioning why I'm going to such lengths: I write a monthly column in a dutch national Newspaper (De Volkskrant) on technology you can apply in your own home. I wrote a piece on the sprak before and wanted to delve a bit deeper for my piece on oktober 18th.
thanks in advance
Rolf
Hi Rolf,
Thanks so much for creating this proof of concept! I look forward to your column—please let us know when it's published.
You can see in the LICENSE file that this repository is distributed under the Apache License, Version 2.0. Here's the full text of the license, and here's the TL;DR version. The license of an open source project is always the official source for what you can and can't do; the Apache 2 license allows a great deal of freedom. :wink:
You can (if you otherwise satisfy the license) distribute your app in the Play Store. I think the best way to distribute the source is to create an open source github fork repository—not for the purposes of creating pull requests, but simply as an easy way to show where the code came from and what you changed.
Cheers!
Hi Zach,
thanks for your clarification! release date for the article in the newspaper is october 18th. Will be all in Dutch though... (I may ask a native speaker friend of mine to make a nice translation and put that on my website).
I uploaded my version of the code to https://github.com/RolfHut/SCAT. I will be uploading never versions as I clean stuff up, but this is the version I got working and also pushed to the play store. Please contact me if there are any issues that I need to change, I have done everything in good faith, but legal is not my strong point (let alone US legal...)
with respect to my second question: any idea how I can flash firmware from within the app, where the firmware is hosted in the app, not in the cloud? The API has support for this, but I have no clue as to how to link to a file in an argument bundle (if that is even possible).
thanks again,
Rolf Hut
As you say, the API supports flashing a binary. Docs here: http://docs.spark.io/api/#verifying-and-flashing-new-firmware-flash-a-core-with-a-pre-compiled-binary
I just did a quick Google search for "android http upload file" and got this example as the first search result: http://androidexample.com/Upload_File_To_Server_-_Android_Example/index.php?view=article_discription&aid=83&aaid=106
Hi @RolfHut. I too am building my first Android app in order to control the Spark Core. In case you're still interested in ways to control it using REST, I've implemented a Retrofit interface for it. It makes the API very easy and concise. You can see it in a blog post of mine, and look at the full source on my GitHub repo.
Hi @PombeirP
looks interesting! I will check it out!
Rolf
This would be really great if app has additional screen for 'variables', 'events' and 'functions' that one could operate on. I want to use this app as a simple mission control for my spark-enabled thing, and as a workaround I am going to connect D1 to D2 with a wire, digitalWrite to D1 with this app, read D2 on the core to give myself control over the logic with this app.
I am trying to change the app to not work with the tinker firmware, but with my own firmware, which has different functions and variables made available to the cloud. However: in the app, the whole idea that this works towards tinker, and the idea of working with pins is very hard (for me...) to separate from the clean API.
Can anyone give me a short tutorial / example on how to: -add a button on the main screen that calls a function on my core. (I got this working, but hacked a lot to get there, not a "clean" solution. -add a button that, when clicked, gets a variable (String in my case) from the Core and displays it. This is the hard part for me: how to configure the different Receivers etc.
mind you: this is my first android app that I am working on, so don't be to harsh... thanks
Rolf