pengwang
pengwang

Reputation: 19956

how to use different mapview at same one mobile

my app is internationalization,so in some country have Fortress mobile phone,which is not have google Mapview,it not use mapactivity,so i cannot install my app to the Fortress mobile phone. so myquestion:

  1. if i can add common map.jar to my app,so i can use the jar to finish my app map effect ,not care mapview in the Fortress mobile phone .i donot know if the seem common map.jar is exist at present

  2. if have other methods to meet my need?

Upvotes: 0

Views: 78

Answers (1)

CSmith
CSmith

Reputation: 13458

If I understand the question correctly, you want to determine, at runtime, whether GOogle Maps exists on the device, and take an alternative path if it does not.

  1. you must build your app with Google Maps API, but set the required flag to "false" in your manifest

<uses-library android:name="com.google.android.maps" android:required="false" />

  1. use code like this to determine if the library exists on the device

try {

   mContext.getClassLoader().loadClass("com.google.android.maps.MapView");

   // You have Google Maps

}

catch (ClassNotFoundException e)

{   

 // No Google Maps

}

Upvotes: 1

Related Questions