2

Since the Google I/O 2013 we can read in several places of the documentation of Google Maps Android API v2 that

This method / interface is deprecated.

use com.google.android.gms.location.LocationClient instead. LocationClient provides improved location finding and power usage and is used by the "My Location" blue dot. See the MyLocationDemoActivity in the sample applications folder for example example code, or the Location Developer Guide.

While it is great the new API appeared, I can't think of any good reason to put @Deprecated on these methods.

They are indeed a very convenient way of accessing location pointed to by the blue dot.

A single line

Location location = map.getMyLocation();

to retrieve my location vs the amount of setup code we need to write using the new Location API to achieve the same result speaks against having them deprecated.

From the MyLocationDemoActivity (under ANDROID_SDK/extras/google/google_play_services/samples/maps/src/com/example/mapdemo/MyLocationDemoActivity.java):

// These settings are the same as the settings for the map. They will in fact give you updates at
// the maximal rates currently possible.
private static final LocationRequest REQUEST = LocationRequest.create()
        .setInterval(5000)         // 5 seconds
        .setFastestInterval(16)    // 16ms = 60fps
        .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);

The comment suggests that these hardcoded values are the same as in the map, but this may change in an undesirable way in future.

So after all the pros and cons are here, what could be the reason behind desision to deprecate these APIs?.

Community
  • 1
  • 1
MaciejGórski
  • 22,187
  • 7
  • 70
  • 94
  • My apologies for voting to close. I had forgotten that StackOverflow is the official support point for Google Maps. However, I have adjusted the tags to the set that the Maps team advertises that they will monitor (https://developers.google.com/maps/forum/). – CommonsWare Jun 06 '13 at 20:35
  • I believe this was introduced to streamline like they usually do, like they did with google play services etc. They give a client and abstract us, so called developers from what happens under the hood. Advantage is more ppl will have access to amazing tricks, disadvantage is lesser ppl will get a chance to learn actual coding. – stack_ved Jul 17 '14 at 20:09
  • @stack_ved The deprecated API is actually **much** easier to use, which is A Good Thing (TM). – MaciejGórski Jul 18 '14 at 10:30

1 Answers1

1

One more point. If GoogleMap uses LocationClient, but we don't have access to its results and we have to use another LocationClient and bunch of listeners, it is two LocationClients for the same task. Pure waste of resources.

ggurov
  • 1,496
  • 2
  • 15
  • 21