Android Forum » Android Developer Forum » Android Developer Forum » How to add favorites objects on Google map for android

How to add favorites objects on Google map for android

How to add favorites objects on Google map for android
created on Feb 11, 2011 8:32:05 PM
I need an reference or explanation how to add favorites (important locations) in my Android app for Google maps. So far, I managed to display map, show my location and get address from point where user is tapped on map. I assume that this is done with overlay class, but how to get list of objects that I want to display?
Thanks
Reply with quote Reply Link ±0     (0 votes)
RE: How to add favorites objects on Google map for android
created on Feb 11, 2011 9:54:13 PM (via AndroidPIT app)
Guess I'm still a little confused as to what you are trying to do.

Any contact that also has an address will show up when you open "Navigation" then contacts.

-----
Download AndroidPIT's AppCenter! AndroidPIT FAQ – Frequently Asked Questions and Answers

Reply with quote Reply Link ±0     (0 votes)
RE: How to add favorites objects on Google map for android
created on Feb 12, 2011 1:47:00 AM
Well, I'm not trying to do that...
I need to show various locations on my map. That locations can be: museum, university, monument, etc. In fact, they are all shown on map, but not as an object, so tap on them does nothing...
This is how it looks in my app and how in Google maps:

Reply with quote Reply Link ±0     (0 votes)
RE: How to add favorites objects on Google map for android
created on Feb 12, 2011 6:02:16 AM — modified on Feb 12, 2011 6:18:26 AM
Check out the onTap method for the overlay class: http://code.google.com/android/add-ons/google-apis/reference/index.html

When someone taps the overlay it will call the onTap method, with GeoPoint P having the point that has been tapped. This won't display all the information that the google maps app displays from a favorites, though. I don't think that information is part of the google maps API, but rather is proprietary to google maps app. I could be wrong. You can display your own information about a favorites, when it's tapped with the onTap method though.

EDIT: Of course you could do most of the same stuff the google maps app does. From the GeoPoint information you could display the address when it is tapped. Put a :"Driver To" link on the map for them to click on, and then call the navigation app with an Intent, specifying the address in the parameters.

2nd EDIT: I wrote a small gps program once, here is the code I used to translate a lat/lon location to an address:

First you would get the lat and longitude from the GeoPoint provided in the onTap method of your overlay:

int lat = p.getLattitudeE6();
int long = p.getLongitudeE6();

Then create a Geocoder object:

Geocoder geoCoder = new Geocoder (getApplicationContext());


address="Could Not determine location."; //initinalize the address to not found

try {

//Use android.location.Location to get an address from a geoCoder object.

android.location.Location locs = geoCoder.getFromLocation (lat, long, 10); // get the address for the lat and long from the GeoPoint

if (locs.get(0) !=null) address=locs.get(0).toString(); //get the string representation of the address from locs
} catch (Exception e) {
//System.out.println ("location: "+e);
}
Reply with quote Reply Link ±0     (0 votes)
RE: How to add favorites objects on Google map for android
created on Feb 12, 2011 11:02:12 AM
Jeremiah McLeod
Check out the onTap method for the overlay class: http://code.google.com/android/add-ons/google-apis/reference/index.html

When someone taps the overlay it will call the onTap method, with GeoPoint P having the point that has been tapped. This won't display all the information that the google maps app displays from a favorites, though. I don't think that information is part of the google maps API, but rather is proprietary to google maps app. I could be wrong. You can display your own information about a favorites, when it's tapped with the onTap method though.

That is what I need, that additional informations... :(
I have onTap method implemented, and all I can extract is address, country, etc.
If that informations are proprietary to google maps app, then must be other way to get them, because I saw a couple of apps whit this functionality...
Reply with quote Reply Link ±0     (0 votes)
RE: How to add favorites objects on Google map for android
created on Feb 13, 2011 12:54:28 AM
Your probably right, but I wasn't able to find it looking through the maps api reference. I'll look again and let you know if I find anything.
Reply with quote Reply Link ±0     (0 votes)
RE: How to add favorites objects on Google map for android
created on Feb 14, 2011 11:38:25 AM
Marko, have you tried contacting the developers of the apps that had the ability you want? As long as you aren't making a competing product, they might be able to help you.

-----
Recommended reading for new AndroidPIT members! Important to all community members: the AndroidPIT Forum rules

Reply with quote Reply Link ±0     (0 votes)
RE: How to add favorites objects on Google map for android
created on Feb 17, 2011 11:55:18 AM — modified on Feb 17, 2011 11:56:30 AM
Jeremiah McLeod
Your probably right, but I wasn't able to find it looking through the maps api reference. I'll look again and let you know if I find anything.
Thanks
Douglas Carter
Marko, have you tried contacting the developers of the apps that had the ability you want? As long as you aren't making a competing product, they might be able to help you.
In fact, I am... They did not reply me yet. :(
I explained them that my application is for final exam on faculty, and that code will not be abused.
Reply with quote Reply Link ±0     (0 votes)