Is it possible to use Google Maps Andr开发者_StackOverflow社区oid library in my app in a way, that the app can be installed even on phones without Google Maps? On phones without Google Maps, the maps feature would be disabled.
Is it possible to use Google Maps Android library in my app in a way, that the app can be installed even on phones without Google Maps?
There is an undocumented android:required="false"
flag you can put on the <uses-library>
element. I am hopeful that they will document this in a future release. With that set to false
, you would need to use reflection to see if Google Maps is loaded (e.g., try to find the MapView
class) -- if not, disable whatever would lead the user to a map.
If anybody else has the same problem (I do):
On this Android Developer page it says -- as far as I can tell -- that you can reference the Maps API and thus have e.g. a map activity in your app by using Google Play services:
"The Google Maps Android APIs are not included in the Android platform, but are available on any device with the Google Play Store running Android 2.2 or higher, through Google Play services.
To integrate Google Maps into your app, you need to install the Google Play services libraries for your Android SDK. For more details, read about Google Play services."
Apparently it is an actual app (it is installed on my phone) that updates certain Google stuff.
So it seems it is possible, but only for devices running Android 2.2 (API level 8) and above.
I find the explanation on that site a bit unclear, however, and I have not been able to test this on my own.
In my case, I guess I have to live with the fact that not all devices will be able to install my app, since I target an API < 8.
精彩评论