I have a large Android application for my company and we heavily use the google maps api for display of positions, including an activity using overlays. The problem is now with support of lower end Android tablets. Since the large majority do not support google maps, our app won’t even install on them. Is is possible to tell the manifest to require the google maps api only if it is available on the device? If not available, I would then just disable the mapping features.
Share
Yes. Include
android:required="false"in the<uses-library>element where you are requesting Google Maps. You can then use reflection to see if, say,MapActivityexists in your Dalvik VM, If it does, you are on a Maps-capable device and can safely launch a map. If it does not exist, you will need to disable your mapping features.Here is a sample application demonstrating this, with a
MapDetectorLAUNCHERactivity that sees ifMapActivityexists and then either forwards control onto an actualMapActivityimplementation or raises aToastif the app is run on a non-Google Maps device.Here is the
MapDetectoractivity implementation from that project: