I am currently developing an android application uses Google map API.
I am wondering do all android devices support map API, becuase this api is an optinal api and i
I needed to see if the library existed before attempting any calling, so I could fill the relevant preferences before-hand. Here's the code I came up with to check.
public static boolean hasSystemSharedLibraryInstalled(Context ctx,
String libraryName) {
boolean hasLibraryInstalled = false;
if (!TextUtils.isEmpty(libraryName)) {
String[] installedLibraries = ctx.getPackageManager()
.getSystemSharedLibraryNames();
if (installedLibraries != null) {
for (String s : installedLibraries) {
if (libraryName.equals(s)) {
hasLibraryInstalled = true;
break;
}
}
}
}
return hasLibraryInstalled;
}
And then I check to see if com.google.android.maps is installed.