I have an Android application that runs Google Maps API v2. By using SupportMapFragment, I support devices running Android as back as API 8. I know Google Maps API v1 is deprecated and that very few devices run Android API 7 or lower, but is there an easy way to define my layout such that for devices lower than API 8, Google Maps API v1 will be loaded?
Asked
Active
Viewed 123 times
0
-
1Do you have a Maps V1 API key? If not, there is no point in bothering with this, as you cannot use Maps V1. – CommonsWare May 24 '13 at 23:22
-
I feel it would be an unnecessary amount of effort for limited gains... Api level 8 and above has 98.2% penetration in the Global Android market... You should really think long and hard whether your userbase constitutes a considerable amount of users below API 8 to be worth the effort for any application you might build. – Sam May 24 '13 at 23:24
-
Yes, I do have the API v1 key. The app had Maps API v1 before I moved to v2. @SamarthJain : yeah, I understand that. If it requires too much effort, I will not pursue it. Wanted to know if anyone had tried / implemented it. – Sap May 24 '13 at 23:30
-
@SamarthJain It really depends on the target. If Sap is targeting emerging markets, it is much higher than that. – MaciejGórski May 25 '13 at 05:46
1 Answers
2
I would simply suggest creating a separate Activity
for API v2 and doing something like this in Activity
that starts maps:
if (isGles20() && isApi8()) {
startNewActivity();
} else {
startOldActivity();
}
You will get some duplicated code, but that's what refacoring is for to extract common logic into some class.

MaciejGórski
- 22,187
- 7
- 70
- 94
-
Oh yeah, thanks! Its been a while since I have been coding, but I am not really good at code design. But still, I should have got this! – Sap May 25 '13 at 09:46