سؤال

I am working on an app that runs a service that has a location listener, and needs to do things in the background.

I am currently integrating Google Maps in my app, do I need to create a different location listener? Do I use the same one, how?

If someone can point me in the right direction for the right way to do it, I would greatly appreciate it...

هل كانت مفيدة؟

المحلول

If you are using google maps v2 just set setMyLocationEnabled(boolean) to true and it will display your location without you having to do anything

نصائح أخرى

In your location Listener, wherever you get your location, you use the googleMaps change position method call.

 googleMap.moveCamera(CameraUpdateFactory.newLatLng(position));

position would be instantiated like so:

 LatLng position = new LatLng(location.getLatitude(), location.getLongitude());

That should do what you want it to do. Spend some time looking at the developer guide for google maps.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top