Archive for July, 2010
Update: August 29, 2010
Tested this myself on a friend’s phone and this bug is definitively not fixed yet despite the recent Motorola updates! The burden is on you (the developer) to fix this if you want your applications to run on a Droid X.
Update: August 23, 2010
Still getting reports that the update issued by Motorola last month did not fix this issue!
As soon as the new Motorola Droid X came out I started getting reports that my applications would crash on it.
The description I was getting from people was that the application would start, then it would show the Google map and start moving the map and zooming in on to their current location and then all of a sudden the app would crash. By crash I mean they get taken back to the phone’s home screen. No “Force Close” dialog pops up… nothing… just gets back to the home screen.
If both the GPS and the Wireless Networks are turned off from the Locations settings then the applications would work fine, but of course that means that the current location of the device would be impossible to find.
At this point I knew that the problem had to do with either the LocationManagers or the LocationOverlays but I had no way of finding out exactly what the problem was until I could get my hands on a Droid X phone and connect it to my computer to look at the execution stack.
Well it turns out the problem is with the default MyLocationOverlay class. The Droid X phones throw an exception when they try to draw the dot showing the location of the device:
E/AndroidRuntime(10458): Uncaught handler: thread main exiting due to uncaught exception E/AndroidRuntime(10458): java.lang.ClassCastException: android.graphics.drawable.BitmapDrawable E/AndroidRuntime(10458): at com.google.android.maps.MyLocationOverlay.getLocationDot(MyLocationOverlay.java:180) E/AndroidRuntime(10458): at com.google.android.maps.MyLocationOverlay.drawMyLocation(MyLocationOverlay.java:561)
Another developer (rgfindl) who had the same problem like I did and who had already made the trip to the Verizon store gave me the above stack trace.
Several possible solutions popped into my head:
1. Stop using the MyLocationOverlay class and start relying only on the LocationManager classes and draw/redraw my current location onLocationChanged.
2. Extend from MyLocationOverlay class and override the draw method.
3. Stop supporting the Droid X.
None of these solutions are ideal with the last one being almost unacceptable.
Luckily the same developer also gave me a link to a solution implementing the 2nd option above, so I did not even have to code it myself. Apparently that is not the first time Motorola phones (Motorola Cliq and Motorola Dext) have a problem with this class. Most likely their builds are missing the drawable resource.
Anyway, the solution consists of the .java file that implements the FixedMyLocationOverlay class, which inherits from the default MyLocationOverlay class and overrides the drawMyLocation method. And a .png file with a dot that will be representing the current location on the map.
Just use this derived class FixedMyLocationOverlay instead of the default MyLocationOverlay. If you look at the implementation of the drawMyLocation method, you will see that if the phone has no problem it will use the default implementation of the parent class, but if it throws an exception it will use the custom code to draw the location.
I would think that there are a lot of applications in the Android Market right now that use the default MyLocationOverlay class and all of them will be crashing on the new Droid X until either Motorola gets their act together or the developers realize the issue and work around it.
The latest Android OS version 2.2 (“Froyo”) was announced at the Google I/O conference on the 11th of May. As you already probably know it adds multiple enhancements like tethering, wifi hotspot functionality, full support for Flash, etc. Since I use my Nexus One phone for Android development, I did not want to download the update from Google and then install it with adb. I just wanted to wait for the over the air update.
And to my surprise, the first time I looked at my phone this morning, I had this message on the screen:
I was not sure how long it would take, so I just hit “Install Later”. Then a couple of hours later, when I was ready, I just went to Settings -> About Phone -> Software Update and hit “Restart & Install”:
The phone rebooted and started the upgrade. The whole process with the installation took less than 5 minutes.
I am not going to go into details what the features of Android 2.2 are. There are so many announcements and blog posts on this matter already out there…
But what I am going to say is that Android is the leading OS in the mobile phone market right now. I can say this definitively, since I have been using iPhones for the past 2 years. I have a 3G and a 3GS phones. I encourage any iPhone user to go and check out an Android device. Please do not look at the low end hardware that runs Android (like the Cliq, the old G1, etc.). Check out the HTC Evo, the HTC Incredible, the Nexus One etc. See for yourselves before you make your decision to get another phone and lock into a 2 year contract. I will mention only a few things you will discover on the Android device that your phone probably does not have right now:
- Turn by turn voice navigation
- Built in tethering
- Built in WiFi hotspot capability supporting multiple devices
- Full support for Flash
- Full blown multitasking on the OS level (no need for the programmer to do anything special)
- Integrated speech recognition across the board. Voice input could be used anywhere in place of the text input.
- Over the air updates and syncing. That means no iTunes or the like!
And many other features that I do not want to get into details right now. I am sure you can fill in the gaps for yourselves…
- Olivier on Dynamic Port Forwarding with SOCKS over SSH
- Ld7 on How to connect your Android phone to Ubuntu to do development, testing, installations or tethering
- get more Info on How to get Picasa images using the Image Picker on Android devices running any OS version
- Casper on How to detect a user pan/touch/drag on Android Map v2
- Install SSH as socks proxy for dynamic port forwarding | Steve Constine on Dynamic Port Forwarding with SOCKS over SSH
- April 2013 (1)
- November 2012 (2)
- August 2012 (1)
- May 2012 (1)
- March 2012 (1)
- November 2011 (1)
- August 2011 (1)
- April 2011 (1)
- January 2011 (2)
- September 2010 (1)
- August 2010 (2)
- July 2010 (2)
- June 2010 (2)
- May 2010 (1)
- January 2010 (2)
- December 2009 (2)
- November 2009 (3)
- October 2009 (1)
- September 2009 (3)
- July 2009 (1)
- May 2009 (1)
- March 2009 (1)
- February 2009 (2)
- January 2009 (2)
- December 2008 (1)
- November 2008 (4)
- October 2008 (5)