android - Adding a sound when an user aproach a marker on GoogleMaps API V2 -


i developed application using googlemaps new api 2.0, app working , , showns user's location , markers, delimits off limits area in cities here in italy. add sound when user aproach 1 maker, seems there no method interact objects added on map. idea, bad idea, work user's coordinates , matrix of markers coordinates, checking user near to; slow , bad can see it.

so question is:

is there common way check when user near poi , add sound listener ?

thanks in advance

i hope answer you. :)

use locationmanager , locationlistener. can user's gps postion in real-time. os push "location" "onlocationchanged()" should implement locationlistener. check distance between location of listener , marker's lat/lon. play sound when user approach in 500m (maybe..)

fyi, can request gps , network lcoation simultaneously. may know network position not accurate. use gps position if need more precise user's position.

mlocationmanager.requestlocationupdates(locationmanager.gps_provider, 5000, 0f, mlocationlistenergps); mlocationmanager.requestlocationupdates(locationmanager.network_provider, 5000, 0f, mlocationlistenernetwork); 

and not forget removing requesting if don't need locating.

mlocationmanager.removeupdates(mlocationlistenergps); mlocationmanager.removeupdates(mlocationlistenernetwork); 

do not use locating long time. locating uses huge battery.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -