Google recently previews its new Google Maps. The new interface looks more comprehensive and stunning:
However, the trade-offs are speed and memory comsumption.
At the time of writing this post, I still favor the classic Google Map which offers a much simpler UI but more responsive experience.
New Google Map
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
iexplore.exe 1804 Console 1 461,972 K
firefox.exe 4800 Console 1 645,508 K
Classic Google Map
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
iexplore.exe 4148 Console 1 160,116 K
firefox.exe 1204 Console 1 221,092 K
Software design needs to strike a balance between performance and functionality and UI in order to provide great user experience for customers. So,
1. Do you really prefer the Shining map to the Responsive one, when you are running out of time for catching a flight, but only eager to know the fastest route to the airport?
2. User-oriented is good, but not glod-plating
Showing posts with label Google Map. Show all posts
Showing posts with label Google Map. Show all posts
Tuesday, July 30, 2013
Sunday, November 13, 2011
Use Mock GPS Location for Android Development - Part Two
In the first part of this topic, several simple methods for sending mock GPS location data to the device or emulator have been discussed. They are convenient when you need only test one GPS location at a time. However, when you want to test a consecutive points set (e.g. a route for a moving vehicle) for your app, these methods are not that handy. Therefore, in this part, two other simple ways for mock continuous GPS locations for testing your app are provided: one is using KML file, another way is writing a small app to provide the mock GPS locations updates.
Using KML on DDMS:
The easiest way to send a path of GPS points to the emulator is through the Location Controls in the DDMS for Android emulator. Just need a KML file for storing the path, and use DDMS to send this path of locations to the emulator at a certain interval.
1. Start the Google Earth desktop application and click on "Add" and then "Path" to draw the path:
2. "Cltr+S" to export the route as a kml file on to your disk;
3. Use a web tool (e.g.ge2adt) to convert that the Goolge Earth route into the Eclipse ADT compatible kml format; (here is the sample kml route file after the conversion)
Or, if you don't want to use Google Earth, the KML file format for the Android emulator is like:
2. Start the test GPS;
3. Start the target app that use the test GPS's updates (e.g. Google Map on Android).
You can download the code from here.
The app supports:
1. Define the path
2. Generate the mock GPS updates loop around the path at regular interval
3. Work in the background (allow you to start the target app)
About the Code:
The MockLocationBuilder class extends the MapActivity class to display and manage the map:
public class MockLoctionBuilderActivity extends MapActivity
Then specify the location provider's name:
static private String mTestProvider = LocationManager.GPS_PROVIDER;
To add the mock location provider, you can use this function:
private void addMockLocationManager() {
mLocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
if (mLocManager.getProvider(mTestProvider) == null)
{
mLocManager.addTestProvider(mTestProvider, false, false,
false, false, false, false, false,
android.location.Criteria.POWER_HIGH,
android.location.Criteria.ACCURACY_FINE);
}
mLocManager.setTestProviderEnabled(mTestProvider, true);
}
Note that you can only specify the provider to be LocationManager.GPS_PROVIDER on the emulator but not on a real device, because the addTestProvider method will throw the error for the provider named "gps". To use on the device, you can specify the mTestProvider as some other strings.
And set the mock location at a regular interval through this method:
private void setMockLocation(double latitude, double longitude) {
Location newLocation = new Location(mTestProvider);
newLocation.setLatitude(latitude);
newLocation.setLongitude(longitude);
newLocation.setTime(System.currentTimeMillis());
mLocManager.setTestProviderLocation(mTestProvider,
newLocation);
}
Note that the newLocation.setTime method set the timestamp when the new location is generated, which makes the location listener takes in it as an updated location.
Release the provider after the running by:
if (mLocManager.getProvider(mTestProvider) != null)
mLocManager.removeTestProvider(mTestProvider);
PS: 1. On the device, remember that the system might setup the LocationManager.GPS_PROVIDER as the default provider, so that you cannot call the addTestProvider method on it. However, you can specify the test provider to be some other name and use the same test provider in the target app for location updates;
2. You may want to change the frequency of the GPS updates.
Ref:
This post provides more detailed discription of the important methods:
http://ballardhack.wordpress.com/2010/09/23/location-gps-and-automated-testing-on-android/
Using KML on DDMS:
The easiest way to send a path of GPS points to the emulator is through the Location Controls in the DDMS for Android emulator. Just need a KML file for storing the path, and use DDMS to send this path of locations to the emulator at a certain interval.
1. Start the Google Earth desktop application and click on "Add" and then "Path" to draw the path:
2. "Cltr+S" to export the route as a kml file on to your disk;
3. Use a web tool (e.g.ge2adt) to convert that the Goolge Earth route into the Eclipse ADT compatible kml format; (here is the sample kml route file after the conversion)
Or, if you don't want to use Google Earth, the KML file format for the Android emulator is like:
4. Start the Android emulator and your GPS location app; Click on the "Load KML..." on the Location Controls field in the DDMS to load the path kml:
Using the MockLocationBuilder:
The following small app is to send the mock locations that a user has specified to the emulator (or real device). The app works like this:
1. Start the MockLocationBuilder and draw the path;The following small app is to send the mock locations that a user has specified to the emulator (or real device). The app works like this:
2. Start the test GPS;
3. Start the target app that use the test GPS's updates (e.g. Google Map on Android).
You can download the code from here.
The app supports:
1. Define the path
2. Generate the mock GPS updates loop around the path at regular interval
3. Work in the background (allow you to start the target app)
About the Code:
The MockLocationBuilder class extends the MapActivity class to display and manage the map:
public class MockLoctionBuilderActivity extends MapActivity
Then specify the location provider's name:
static private String mTestProvider = LocationManager.GPS_PROVIDER;
To add the mock location provider, you can use this function:
private void addMockLocationManager() {
mLocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
if (mLocManager.getProvider(mTestProvider) == null)
{
mLocManager.addTestProvider(mTestProvider, false, false,
false, false, false, false, false,
android.location.Criteria.POWER_HIGH,
android.location.Criteria.ACCURACY_FINE);
}
mLocManager.setTestProviderEnabled(mTestProvider, true);
}
Note that you can only specify the provider to be LocationManager.GPS_PROVIDER on the emulator but not on a real device, because the addTestProvider method will throw the error for the provider named "gps". To use on the device, you can specify the mTestProvider as some other strings.
And set the mock location at a regular interval through this method:
private void setMockLocation(double latitude, double longitude) {
Location newLocation = new Location(mTestProvider);
newLocation.setLatitude(latitude);
newLocation.setLongitude(longitude);
newLocation.setTime(System.currentTimeMillis());
mLocManager.setTestProviderLocation(mTestProvider,
newLocation);
}
Note that the newLocation.setTime method set the timestamp when the new location is generated, which makes the location listener takes in it as an updated location.
Release the provider after the running by:
if (mLocManager.getProvider(mTestProvider) != null)
mLocManager.removeTestProvider(mTestProvider);
PS: 1. On the device, remember that the system might setup the LocationManager.GPS_PROVIDER as the default provider, so that you cannot call the addTestProvider method on it. However, you can specify the test provider to be some other name and use the same test provider in the target app for location updates;
2. You may want to change the frequency of the GPS updates.
Ref:
This post provides more detailed discription of the important methods:
http://ballardhack.wordpress.com/2010/09/23/location-gps-and-automated-testing-on-android/
Wednesday, September 21, 2011
Use Mock GPS Location for Android Development - Part One
Recently, I am working on an Android google map app that requires some fake GPS position input. Here are several easy ways for you to quickly input mock GPS locations for your Android development:
Using Emulator:
1. Using geo fix
cd to your .\android-sdk\tools\ folder, and then telnet to your avd. e.g.
$ telnet localhost 5554
$ geo fix -118 35
$ exit
The help geo fix shows that it takes these parameters 'geo fix log lat'...
2. Using DDMS
In your emulator control view, using the Location Controls to send the location, e.g.
Using Android Device:
Use mock location generation tool like Location Spooler: https://market.android.com/details?id=org.ajeje.fakelocation&feature=related_apps
1) Start location spooling
2) Start the app
Note:
1. Remember to save in the android manifest xml the mock location permission;
2. Enable the mock GPS location access on your droid phone.
Also refer to here:
http://stackoverflow.com/questions/2531317/android-mock-location-on-device
Using Emulator:
1. Using geo fix
cd to your .\android-sdk\tools\ folder, and then telnet to your avd. e.g.
$ telnet localhost 5554
$ geo fix -118 35
$ exit
The help geo fix shows that it takes these parameters 'geo fix log lat
2. Using DDMS
In your emulator control view, using the Location Controls to send the location, e.g.
Using Android Device:
Use mock location generation tool like Location Spooler: https://market.android.com/details?id=org.ajeje.fakelocation&feature=related_apps
1) Start location spooling
2) Start the app
Note:
1. Remember to save in the android manifest xml the mock location permission;
Also refer to here:
http://stackoverflow.com/questions/2531317/android-mock-location-on-device
Subscribe to:
Posts (Atom)

