19

I read through the google maps API documentation and under MapFragment, it advises to use the class only when targeting API 12 and above. Then I assume that SupportMapFragment targets API 11 and below, though google didn't explicit mention it in the documentation. Then what if I want to target a wide range of API lvl? Does SupportMapFragment also targets API above 11?

user2168777
  • 203
  • 1
  • 3
  • 5

2 Answers2

44

Then I assume that SupportMapFragment targets API 11 and below, though google didn't explicit mention it in the documentation.

SupportMapFragment is for use with the Android Support package's backport of fragments. It can be used on Android devices running API 10 and lower, as well as Android devices running 11 and higher. MapFragment requires the native API Level 11 fragment implementation, and therefore can only be used on API Level 11 and higher devices.

Note that there are no devices running API Level 11 that I know of -- everything has been upgraded at least to API Level 12.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • 1
    that is what I wanted to know. I just got confused reading the API documentation. Thanks! – user2168777 Mar 15 '13 at 10:10
  • 1
    My phone is still running API lvl 9. The HTC Desire HD did not get the os upgrade as Google considered the Sense on this phone so "good". I have just looked at the stats and still 24% are using 2.3 or older versions of Android. – erdomester Feb 24 '14 at 21:49
  • @erdomester: And to support those devices, you would need to use `SupportMapFragment`, as noted in my answer. – CommonsWare Feb 25 '14 at 06:26
  • 1
    @CommonsWare: I know that. But then what did you mean by saying "Note that there are no devices running API Level 11 that I know of"? – erdomester Feb 26 '14 at 07:26
  • 2
    @erdomester: I did not say "API Level 11 or lower". I said "API Level 11". There are no devices running API Level 11 that I know of. – CommonsWare Feb 26 '14 at 07:28
0

One nevertheless is forced to use SupportMapFragment in general, because it can be cast:

SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map);
if (mapFragment != null) {mapFragment.getMapAsync(this);}

For some reason FragmentManager cannot return MapFragment, despite it is generally known.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216