I'm building a little app for Nokia S60s that has to talk to the GPS, and
we decided to use
KuneriLite, the Flash-on-steroids wrapper for mobile devices that cool kids in town use these days. Because of
HippoHX now every time I see/use a Flash wrapper can't help to compare with it, but I'll leave that for the end of the post.
Setting up Kuneri is a little bit messy. There's a nice list of very specific requirements, so my advice if you want to give it a go is:
1) Get Kuneri, install and open the requirements wizard.
2) Install the requirements the wizard tells you about in the same order and the same versions,
use the links they provide. I specially got problems with S60 SDK because I got a wrong version. With Java I saw the
missing DLL error.
[BTW, to download the S60 SDK you have to register with Nokia, what a nice way to annoy your developers. I'd like to know the % of real data they get. So well done Adobe for not requiring this annoying step to get Flex SDK]
3) Until you can't compile the test application, you will not be good to go.
Once you are all set up, you can start using Kuneri. Create a new project, add the plugins you want to use, compile, install and live happy ever after.
Where's my API dude?It turns out Kuneri is a tiny webserver on the phone, thus you communicate doing http requests and parsing the results you get. Somehow weird, but whatever, I'll play along. What I was
really surprised about is that there's no official higher ActionScript API. I mean, if you want to talk to the GPS, the
documentation tells you to do something like this:
[code lang="actionscript"]loadVariables("http://127.0.0.1:1001/Basic/GPS?klCommand=read","");[/code]
loadVariables? Sorry,
are you from the past? Apparently they are not, they recommend loadVariables to be compatible with FlashLite 1.1. But because of that you also have to use a MovieClip and an interval to receive the answer from the server. A graphical element to receive the answer from a network call, that's good ol'Flash in all its glory!
The point is KuneriLite doesn't provide at the moment a clean ActionScript API to use their plugins, they only document how you should make the requests and what you should expect as their response. No way in hell I'm going through that so I'm presenting (drum roll, please):
Kuneri ActionScript APICheck it out:
[code lang="actionscript"]var gps : GPS = new GPS();
gps.read(Delegate.create(this, handler));
function handler(response : GPSResponse) : Void
{
trace(response.latitude + ", " + response.longitude);
}[/code]
That's much better. Not only you hide all the crap of calling the server, you also get a strictly typed response. Sweet. ATM I've only created the API for the GPS because that's what I need now, and also the Camera for the sake of it, really. I'm not sure if I'm going complete it and I'm almost sure I'm not going to keep up in sync with Kuneri development, so if anyone is interested, please contact me, I'll gladly handover the project.
Special thanks to mr
Elecash for explaining to me the
why-the-hell-they-use-loadVariables mystery and for pointing out
this nice bug that, thanks to him, nobody else has to suffer. Plus, he's always available on IM for my silly FlashLite doubts. Yo! Thanks mate :)
Extra ball: KuneriLite vs HippoHXAs I said at the beginning, can't help but compare Kuneri with HippoHX. Here we go:
- Both are based on somebody else's codebase (SWHX and S60 SDK), but because SWHX is Open Source I can redistribute it myself saving the hassle to my final user, something that Kuneri can't with Nokia's SDK. Another nice side effect is that if a new version of SWHX breaks HippoHX for some reason, I can hold the HippoHX release till I fix the problem.
- HippoHX GUI is only that, a GUI to the CLI packager, so you can integrate it with your compilation scripts. I have the feeling that Kuneri GUI is the same, but haven't seen the documentation.
- HippoHX GUI doesn't use the installation folder to store its data, it uses user's space for that. See
Where should cross-platform apps keep their data? to know why.
- SWHX and HippoHX are for Win and Mac and Kuneri is Windows only. Might be because of the dependencies, but I'm not sure.
- I can't find a download for the documentation, it seems to be on-line only.
Some of these are bigger deals than others, and I'm sure the Kuneri team will fix them in the future, but being a commercial app, I feel most of them could/should have been fixed already.
Anyway, will add a link to the OVI store (Nokia's copycat of the Apple store) once the app is finished and ready to download. It's a little silly app, but, hey, I coded it!