Sunday, March 7, 2010

Android emulator cannot resolve DNS server name

I came across this problem and it took me quite some time to figure it out. It was really annoying.

Suddenly each time an app accessed an internet server (http or socket connection) I got an error message "Verbindungsfehler. Bitte überprüfe Deine Internetverbindung" (English: "Connection error. Please check your internet connection"). The Android log showed this: "InetAddress(192): Unknown host mydomain.com, throwing UnknownHostException" and in another app just this: "UnknownHostException". When using an IP address instead of a domain name everything worked fine. And in the Android browser even domain names worked so it was just a problem of the apps!

In the end, after some frustrating hours of research the reason (and solution) turned out to be this: I'm running Windows on my notebook and my LAN connection is set up to have a fixed IP address and fixed DNS server which I use this in the office. The DNS server is operated by the internet provider. But then I was online with another connection - wireless - and LAN was disconnected. It appears that the Android emulator was using the DNS server of the LAN connection - though not connected - and not of the wireless connection. For some reason the DNS server did answer but with no result. You can check which DNS servers the emulator is using when starting emulator with the -debug-slirp command line argument. In my case it was the LAN DNS server as well as the wireless DNS server but it seem Android didn't care about the latter ones.

The solution was to simply to deactivate the LAN connection in Windows. See also Android Dev Guide / Emulator / DNS

Friday, February 5, 2010

creative workline belegt den dritten Platz bei der A1 Developer Challenge

Ende Januar war es soweit: Die Gewinner der A1 Developer Challenge wurden in Wien gekürt. Abgestimmt hat nicht etwa eine Jury - nein, am Wort waren einzig und alleine die Endkunden, deren Downloads auf dem Vodafone live! Portal über ein Monat hinweg gezählt wurden. Den 1. Platz belegte das Social Community Service mogree, 2. wurde yasssu MOBILE. Beiden möchten ich hiermit nochmal herzlich gratulieren! Und 3.: Unsere Smartphone App Parking Tracker. Die Idee hinter der Applikation kann in einem Satz zusammengefasst werden: Mit dem Parking Tracker vergisst man nie mehr, wo man sein Auto geparkt hat.

Den Parking Tracker haben wir speziell für die A1 Challenge entwickelt. Ziel war es dabei einerseits den Endkunden auf möglichst einfache Weise einen möglichst hohen Nutzen zu bieten - das Ganze sollte alltagstauglich und vom durchschnittlichen Handybenutzer leicht bedienbar sein. Andererseits dient der Parking Tracker als Proof of Concept, wie in minimaler Zeit eine Applikation für die Plattformen Java ME, Blackberry und Android entwickelt werden kann.

Wir werden nun den Parking Tracker weiter verbessern, neue Features einbauen - Ideen gibt es bereits - und natürlich vermarkten. Letzeres vorerst über A1 und in weiterer Folge auch über App-Stores.

Fazit: Eine App muss keine Feature-Monster sein um Erfolg zu haben. Oftmals ist es besser mit Einfachheit und konkreten Lösungen für Alltagsprobleme die User anzusprechen. Was ist eure Meinung?

Offizielle Pressemitteilung: mobilkom austria, APA OTS, pressetext

Saturday, December 19, 2009

Android Emulator Consuming 100% CPU

I had this problem: When I started the Android emulator it pegged 100 percent of one CPU (50 percent of the total with two cores) regardless of whether any app was running on the emulator or not. Searching the web I found some hint for a workaround which I want to share with you:

You need to turn off "Orientation" sensing in "Settings/Sound & Display". This is not a fix but at least a workaround. It appeared in the 1.5 and 1.6 version but it seems to be fixed in 2.0.1. I worked on Windows XP SP3 but I suppose the problem exists on other operating systems like Mac OS and Linux as well.

Here's a link to Issue 3099 in the Android issue tracking system - the status is still "new"!?

Thursday, December 10, 2009

Unsere Apps gratis zum Download bei A1

Für alle A1-Kunden in Österreich: Jetzt die creative workline Smartphone Apps 'Parking Tracker' und 'Tourality - move your mobile!' direkt aufs Handy herunterladen - gratis. Unter Vodafone Live! > Anwendungen > A1 Challenge. Die Aktion ist zeitlich limitiert! Tourality gibt es für Java-fähige Handy, den Parking Tracker gibt es auch für BlackBerry und Android.

Mit dem Parking Tracker vergessen Sie nie mehr, wo Sie Ihr Auto geparkt haben. Zum Abspeichern der Park-Position drücken Sie einfach einen Button. Später, wenn Sie ihr Auto wieder finden wollen, drücken Sie einen anderen Button. Die Position des Autos wird dann auf einer Karte angezeigt, ebenso wie Ihre eigene. So finden Sie jederzeit und überall Ihr Auto wieder!

Tourality - move your mobile! ist ein neuartiges Spiel für Handys, das sportliche Outdoor-Aktivität mit virtuellem Spielerlebnis vereint. Dabei stellt sich der Spieler im Gegensatz zu normalen Sportsimulationen der realen Herausforderung, geografisch definierte Punkte - so genannte "Spots" - in der Realität möglichst schnell und vor Mitspielern zu erreichen. Die Fortbewegung des Spielers wird per GPS ermittelt, hat direkten Einfluss auf den Spielverlauf und wird an die Mitspieler in Realtime verteilt. Web: http://tourality.com

Sunday, December 6, 2009

LWUIT - Frequently Asked Questions - FAQ

Reading Sun's LWUIT mailing list and forum for quite a long time now I decided to compile my personal "favorite" list of questions that are being asked over and over again. The goal is that people find it before they feel the need to ask it in the forum again. Shai, Chen (the two main developers of LWUIT at Sun) and other forum members will probably answer in a very minimalistic way to such questions so I'll try to add a little more background info here.

Make sure to also read the official FAQ section of the LWUIT project.


Q: Special characters like ñ, á, ä, é, í, ó, ö, ú, ü are not displayed?
A: Add these chars (umlaute, etc.) to your charset or avoid bitmap fonts. The charset can be modified in the LWUIT Designer or if you use the ant taks in the "charset" attribute of the "font" tag.

Q: How build LWUIT for RIM BlackBerry?
A: Shai wrote an Article about this lately: Building A Project On The BlackBerry. For my personal taste it's focused too much on NetBeans, neglecting people that use Eclipse instead. But using bb-ant-tools only requires Ant which makes it independent of the IDE, so just take the build.xml file as a starting point. Here's an interesting BlackBerry forum thread: How to use bb-ant-tools with Eclipse. And here's another article by Thorsten - the guy who wrote ports for BB and Android, thanks for that! - on this topic. You can even get the example ant build scripts from there!
Maybe I'll also dedicate a whole post for this topic in the future.

Q: Can I format text within a TextArea, similar to RichText or HTML?
A: LWUIT doesn't support this feature, but there is a class called RichTextArea in the lwuitfixes project. Here's its description: "Displays rich text, where 'rich' refers to variations in font size and style." I have not used it myself - but probably will need it one day.

Q: Should I reuse Forms and Components or instantiate them new every time?
A: Basically Forms and Components are leightweight objects (as the name 'LeightWeight UI Toolkit' suggests) so there is not too much to worry about when recreating them. It depends a lot on your use case, trading off memory vs. CPU performance. Generally it's better approach to keep the memory footprint as low as possibly and tweak performance only when you run into problems or have an unresponsive UI.

Q: I get a java.lang.IllegalStateException when I try to draw on a Image's Graphics object?
A: Probably what you have is an immutable Image from a file which you cannot paint on. Create an "empty" mutable Image with Image.createImage(width, height) and paint the Image from the file on it's Graphics. Check the javadocs of the Image class.

Q: Can I use LWUIT in commercial projects and applications?
Yes, LWUIT is licensed under GPL + Classpath Exception so it is 100% free for commercial use! See Shai's post.

I will add more QAs over time here. Feel free to add comments and help me improve this article.

Wednesday, December 2, 2009

New blog online

The corporate blog of creative workline is now online. It will deal with topics around location based services and games, Java and web development, LWUIT, mobile applications, etc. Stay tuned for more posts to come.