views:

321

answers:

3
A: 

Hello MapView shows how to place overlays. I think you want to use the MyLocationOverlay class documented in the google APIS reference to get your current location.

RickNotFred
Another good sample that does much more than what you're looking for is the friend finder app on anddev.org: http://www.anddev.org/the_friend_finder_-_mapactivity_using_gps_-_part_i_-_ii-t93.html
RickNotFred
A: 

"http://developer.android.com/guide/topics/location/index.html" talks about the location services supported by the device.

If you're looking for provider-specific solutions, then look at the following for an example of using a Sprint service:

http://www.androidref.com/#SprintServices

Jay

AndroidRef.com
A: 

In order to get the current location of your phone I use

LocationManager locationManager = (LocationManager)this.getSystemService(LOCATION_SERVICE);
Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_COARSE); String bestProvider= locationManager.getBestProvider(criteria, true); Location loc = locationManager.getLastKnownLocation(bestProvider);

define uses-permissions in the AndroidManifest.xml for these (use the fine location for other stuff)

ref. http://code.google.com/p/android-bluetooth-on-motion/source/browse/trunk/BluetoothOnMotion/src/com/elsewhat/android/onmotion/BluetoothOnMotionService.java

In my application I would like to pass a paramter to the maps intent in order for maps to show a marker, but have found no way of doing it. Creating a location overlay as suggested by Rick (who is not Fred) is probably the way to go

dparnas
when i incorporated this code in my program, it returns a null location.
lulala
weird. Have you setup the AndroidManifest.xml in the same manner as me, ref http://code.google.com/p/android-bluetooth-on-motion/source/browse/trunk/BluetoothOnMotion/AndroidManifest.xml ?
dparnas