Wednesday, June 27, 2012

Simulate Location Change in Android Emulator


Start the Emulator
Start a command prompt
Start telnet
Then, type, o localhost 5554
This connects the telnet client to the android emulator (assuming emulator is running locally listening on port 5554. Else this connection fails)
Now type
geo fix 79.000000 13.000000 (or your latitude and longitude)
This sends the location change signal to the emulator.
NOTE: This is useful for applications built using Location APIs in Android and need to work with changes in location

Google Redefines GPS Navigation Landscape: Google Maps Navigation For Android 2.0

If you weren’t sure about switching to an Android phone in the near future, this might put you over the edge. Google Maps Navigation is an absolutely killer app. And it is only available for Android 2.0 phones.
Today is Droid day, and for the most part Google is taking a backseat and letting their partners get most of the attention. But Droid is the first Android phone to run Android 2.0, and Google Maps Navigation is clearly the early trophy app for those devices.
Google Maps already has 50 million active users across various mobile phones, says Google. But what users have today isn’t even close to the new Navigation product.
First off, it’s connected, which puts it ahead of all but a tiny percentage of in-car navigation systems which have no Internet connectivity (Dash is a notable exception).
The application is also completely free. So all those paid navigation apps (Navigon, TomTom, CoPilot, MapQuest, GoKivo and Sygic Mobile) are at an immediate disadvantage.
But even if Google charged for this app, it would still win hands down. The features include easy search (no need for address), voice search, traffic information (from data sources and crowd sourced from app), and street view close up pictures when you get near your destination. And the car dock mode gives bigger, simpler icons and auto-voice mode (see video):
Search in plain English. No need to know the address. You can type a business name (e.g. “starbucks”) or even a kind of a business (e.g. “thai restaurant”), just like you would on Google.
Search by voice. Speak your destination instead of typing (English only): “Navigate to the de Young Museum in San Francisco”.
Traffic view. An on-screen indicator glows green, yellow, or red based on the current traffic conditions along your route. A single touch on the indicator toggles a traffic view that shows the traffic ahead.
Search along route. Search for any kind of business along your route, or turn on popular layers such as gas stations, restaurants, or parking.
Satellite view. View your route overlaid on 3D satellite views with Google’s high-resolution aerial imagery.
Street View. Visualize turns overlaid on Google’s Street View imagery. Navigation automatically switches to Street View as you approach your destination.
Car dock mode. For certain devices, placing your phone in a car dock activates a special mode that makes it easy to use your device at arm’s length.

Android Eclipse link Error - New Project


I set up a new environment on my new laptop with Windows7 and jdk1.6.0_21 version. Did the initial setup with eclipse installation, android SDK installation, installing the ADT plugin on eclipse etc. I then imported all the android projects I had created so far. It worked perfectly fine.
Next I created a simple project without any custom stuff, it failed to create with a link error as shown in the image below:

After much trial and error, setting up everything afresh, changing or creating a new workspace, nothing seemed to work. I noticed that the Android package was not visible in the Java build path that you get to see in the project properties. So, finally I found a manual workaround to overcome this problem if you mandatorily want to continue working in the same workspace
Solution: Same workspace:
The manual resolution I found is to make a classpath entry in the .classpath file outside the eclipse environment.
The .classpath file may have such an entry before you edit it:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
     <classpathentry kind="src" path="src"/>
     <classpathentry kind="src" path="gen"/>
     <classpathentry kind="output" path="bin"/>
</classpath>
So add an entry for the android framework to be included as shown below:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
     <classpathentry kind="src" path="src"/>
     <classpathentry kind="src" path="gen"/>
     <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
     <classpathentry kind="output" path="bin"/>
</classpath>
What actually corrupted my workspace, i have not yet figured out. However, while searching on the web for all possible solutions, I came across the announcement on the eclipse forums that Eclipse 3.3 to 3.6 on windows platform is not stable with the JDK version -  jdk1.6.0_21. Hence we need to either roll back to patch 20 or upgrade to 22. I have upgraded and see that eclipse is far more stable now.
Please see this link for more details on the windows and jdk problem mentioned above:
Solution: Different or new workspace:
Just upgrade your JDK to jdk1.6.0_22 and point eclipse to use this as the default JDK. Create a new workspace and you are done. It fixes the problem.
Hope this helps many not to waste time on searching a solution that is not to do with the way you are coding but with the environment set up itself. I had to spend quite a bit of my precious time before figuring this out.