Sunday, April 17, 2011

The blackberry pause

I have to confess it : I made a small pause in my Android development.
During one month, I developped for the Blackberry Playbook, and it was a rather pleasant experience !

Actually, it started when I read this blog entry from James Becwar.
Blackberry offered a free Blackberry Playbook ( their incoming tablet ) if you developped a application for it.
This was a very tempting offer, so I decided to jump into this challenge !

The challenge :

Actually, the challenge was that I read this blog entry on the 26th of February, and you had to submit your application before the 15th of March...
I only had about 15 days to learn a new language, a new platform, a new submission process, and to develop my application.
All that, while still having to manage my real job, my kids, my wife, my friends...

On top of this, a friend proposed me at the very same time to play a 'Neptune's Pride' play. "Neptune's pride" is a nice strategy online game, that played over 2 to 3 weeks. The things is when the game starts, you only have 4 units, so everyday it takes about 10 minutes to play. But the game quickly becomes more challenging, and more time consuming. Way too much for me ! But I couldn't make myself reasonable, and give up. So I played until the end ( I even won the match :) ! ).

Developping for the Blackberry Playbook :

So I decided to start to develop for the Playbook.
There are two ways one can develop for the playbook :
- Using Adobe Air
- Using Html5

I decided to go the Html5 way : it is free ( I could use an evaluation version for Adobe Air, but I prefer to learn something that  I will use as much as I want ), and I feel like learning Html5 can always be a good thing, for my work, for my android development, for some personal Web develpment, etc...

The tools to develop for the Playbook :

The playbook comes with an SDK, and an emulator that really is a virtual Machine running under VmWare.

Considering the short time I had to develop my application, I decided to stay as far away as possible from the device specific issues, so I decided to choose an application as simple as possible, and that I could develop as much as possible with Chrome.
So I didn't wanted to write files, to use the camera, to use the GPS, or anything like that.
I just wanted to develop in Chrome, and check every day that my development was still working in the emulator.

So the application I chose to develop that a simple sliding puzzle ( also called the 15 puzzle ). Nothing really exciting, but something I really could finish in such a small amount of time.

Developping in Html5

So I started developping in Html5, with Chrome.

Html5 is some Html, css, and javascript.
In my, case, I just took a canvas ( ie a part of the Html page ), and entirely control it in Javascript, from the event response to the display.
So I didn't use the Css at all, I merely used the Html part to create the canvas. So quite all of my development were in javascript.

And to be honest, I was really impressed by this way of developping.
The 'iteration Cycle' - ie the time it takes to make a change in your code, and to check its effects in your application - is really low : you modify your javascript code, and just press F5 in your chrome browser, and voila ! It's done...
It's much better than developping for Android, where the installation phase on the emulator or the real device, and even the compilation phase, for a big application, takes some time.

Chrome contains a full debugger, so tracing a bug is quite easy, and you can even hot change the code !
It also contains some profiling tools, and some tools to monitor the memory usage.
Actually, I was impressed by all the stuff that were in chrome. I only had used it as a (fast) browser, and now I found it was also a valuable develoment environment !!

Obviously, everything is not that easy in the Html5 development world :

Javascript is a strange language:
* not really object ( there is no real inheritance ),
* Actually even creating an object is an strange thing : you create it as a special function !
* sometimes Javascript is not strict enough : if you forget to define a variable as a new one, local to your function ( with the 'var' keyword ), it will use whatever var with the same name it can find in the namespace ( like a global one, or worth, one coming from a caller function ), creating some strange bugs...
* the counterpart of all this strangeness is that javascript is a very flexible langage, so can do crazy things like modifying some methods of an instance of an object at runtime. ( at least for a C++ developper, this is a very crazy thing )
* Chrome optimizes the javascript code, so sometimes, it's hard to debug : the code won't stop at some lines that are actually really executed !
* Chrome is a real development environment, but I still prefer my Visual Studio environment !!!


Developping for the Playbook added some specificities :
* For some reasons, I wanted to use more html5 feature than just using my canvas, and failed. Something as simple as calling specific javascript code with clicking a link didn't work. I didn't investigate, and just put everything in my canvas !
* A lot of features just didn't work, in the real device or in the emulator ( and I don't feel like releasing something without any test ) : sound, videos, orientation support, ...
* The event for managing the touchscreen are a little different from the events for managing the mouse. Nothing really big, but enough to bring me some bugs...


Conclusion :

All in all I was really happy with these development. Actually I manage to create my application in 15 days. At this time, the limit had been postponed to the 31th of March, so I ended up developping another application ( to be honest, I was a little ashamed to only deliver such a simple application as a sliding puzzle ), so I created a coloring game for child, in the next 15 days.

I enjoyed doing these two developments, and could finished them by the deadline.

Some time ago, with some friends from work, we made a kind of context where we were to create a little game prototype during our launch pause. So we only had 1 hour and half to create this prototype.
Actually, I like the idea of developping something as fast as possible.

I would like to do it again, all by myself : to give me the constraint to create a little game in 15 days ( or at least a good prototype ). I always found that some good things were coming from this challenges.

As for the result application, they are some applications I still can be proud of. 
Actually, my older kid likes the sliding game, and both my kids like the coloring game. This is, in my opinion, a really good sign !!!

Now, as this is essentially a Android blog, let's talk a little about more robotic things.
Now that I have two Html5 applications, I will try to port them to Android, and check how easy it it.
Actually, I would like to check if developping directly in Html5 is a viable option for Android, but I really have some big hopes in this area !!


Here are the applications :

The coloring game :




 The sliding puzzle :




































And here are the link to the application for the Blacberry owners that are lost on this Android development blog :

Sunday, April 10, 2011

Word Prospector on Win7 phones !!

Word Prospector is now also on Win7 phones !

Sebastien, a very talented game programmer fellow, has ported it on win7.
Actually, he recoded from scrach, and the result is really nice.
It looks like developping for Win7 is really nice and easy, with Visual studio environment, and the ease of use of C# and the XNA framework.

Here are some screens of the final result :


The gameplay is the same, but the graphic design is nicer than mine (ok, it's not that difficult... I really need to do something in this area... ), with lots of fancy animations !

Wish you the best with this game, Seb !!

Sunday, February 13, 2011

Instable Android, and the 'unable to open database file' bug

Hi everyone,

Welcome to this little ( and scary ) episode of my Android user life :

Yesterday, I came back from Canada. So in the plane, I turned my phone off.
And when I turned it on... It became a (little) nighmare...

I got something like a just installed Android on my phone. So I had to link the phone to my gmail  account again, accept the different Terms Of Service, etc...
Ok... Not that complicated... Not the thing you want to do in the airport, that early in the morning, with not much sleep and a big jet-lag, but, it's still feasible.
Then the background had changed, and all of my shortcut and folders have vanished.
Once again, it's a little painful, but still manageable...

Then I quickly discovered that there was more than just that...
Actually, my android version is now quite bugged :


A Bugged Android :

* All the application installed on my SD card had disappeared !! There are more than one year of 'Spy My Apps' data on it, so this one IS serious. I just than I will find a way to get them back.
* the lock screen is still present, but any combinaison will unlock it !!! This one was rather funny ( at least for me ). Resetting the combinaison in the settings fixed it.
* gmail, Youtube, Google Maps were still in the old version, so I could rapidly found that I prefered the new ones ( but waiting a little get them back automagically ).
* For a reason I still can't understand, Twitter was already in the 2.0 version, but the market was unaware of that, so it tried to download and reinstall the 2.0 version, and just failed. I had to unistall and reinstall it to have the market happy again...
* Finally, and it is perhaps the most important, a lot of application ( my own "Word Prospector" included !!! ) just failed now ! Actually all the applications previously present on my phone and that were using a database are now unable to open it, although they find it.


The "unable to open database file" bug

Actually, I find it quite funny, because for a long time I have this bug in my game where the database couldn't be opened. This bug was strange, because I couldn't reproduce it. Some people had some information that it was coming with a reinstallation of the OS, but I did several OS upgrades without any issue...
Here are some people worrying about this bug :
http://groups.google.com/group/android-developers/browse_thread/thread/a0959c4059359d6f
Here is a google issue on this one :
http://code.google.com/p/android/issues/detail?id=949

The good news is that with this bug present on my phone, perhaps :
1) I can manage to find something to do to fix my game ( actually I would rather call it a workaround rather than a bug )
2) Perhaps someone from google can contact me so that we can try to find where this bug is coming from ?

This bug is affecting ALL the applications that are using databases on my phone, and that were installed on my phone before the reboot.
It is affecting both applications that were installed on the main memory and applications that were installed on the SD card ( in this case, when it would crash after the reinstall ).

Here are some applications that are crashing :
* AndroBlogger ( a blogger application ). It looks like it is crashing because it's using Google Analytics, that in turn, uses a database.

* The official Google Blogger application. For some reason, I don't have the callstack in the logs, but those lines :
Couldn't rename file /data/data/com.google.android.apps.blogger/shared_Prefs/bloggerPrefs.xml to backup file /data/data/com.google.android.apps.blogger/shared_prefs/bloggerPrefs.xml.back
and :
Sqlite3_open_v2("/data/data/com.google.android.apps.blogger/databases/blogger.db", &handle, 6, NULL ) failed.

* Yahoo Mail, with the 'Unable to open database file" line in the callstack

And many others...

Actually, it looks like :
Using google Analytics make the application fail
Using Flurry makes the application fail
And using a webview makes the application fail, as the webview uses a database to store its associated cache.
Admob needs to have access to some image cache, and then crash if it can access it.

Note that clearing the cache / data in the application part of the settings does NOT change anything.  (I imagine it does not really clear the files that create the crashes ).


What can be the cause of the issue ?

My understanding goes like that ( I'm far from being sure it is worth anything, but let's give it a try anyway ) :
When you install an application, some disk space is available for this application only ( data/data/ApplicationName/ ).
To insure that ony the application will have access to this data, I imagine Android uses user rights at the Linux level.
Then when the 'strange Android reinstallation' occurs, perhaps there is a change with the user, and the right are no longer granted. But as the folder name is still the same, the application can't open any file already inside.


What next ?

I imagine a "factory data reset" would reset my phone in a stable state.
But I would first like to try to create a workaround for 'Word Prospector', that would just be to catch the exception around the database usage, and in case of problem, would retry with another database name.
I would still like to find a way to get my data from 'Spy My Apps' back. I'm not sure there is any chance for this one, but... for the moment, I would like to be optimistic.

And... if someone from Google could fix the bug, it would be very nice !!!!

Friday, February 4, 2011

I can read english !!!!

Ok, I'm not a native english speaker ( I'm french actually ), but I still can read (some) english...

So why, why, is it so difficult for me to have access to the application comments in english ?
The new market website is awesome, but I still can't acces any non-french comment...

And for some very specific applications, most comments are in english and I just can't have access to them.
Actually, it is not completely true : I can, on my phone, change my language, then check the comments in the market, then get back to french... But it is far from being practical...

I would really like an option to decide how to filter the comments in both the website and the phone markets.

Sunday, November 14, 2010

The server could not process your apk. Try again...

Today, I wanted to submit a new version of my word game 'Word Prospector'.

Everything was okay, until I uploaded the ask on the market !
There I had this nice message :
"The server could not process your apk. Try again"

Hum...ok...
As I'm a kind of well educated one, and despite what my rational-software-engineer mind told me, I follow the note, and try again...
I tried 3 times, and always get the same message !

Unfortunately, this message is quite cryptic, and is not that helpful !
Google was not my friend here...
Luckily, Google, the search engine, did a better job than Google, the market creator, and I find here the solution :

The manifest should not have an empty 'uses-configuration' tag !

So I just get rid of the "<uses-configuration>" I had in my manifest file, and everything was fine again !

Thanks for the people finding the solution in the first time !!!