I have an android application with Google Maps widged built in. I linked the widget conditionally, that is the code loading the widget looks like this:
public class Starter extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.starter);
try
{
Class.forName("com.google.android.maps.MapView");
Intent i = new Intent();
i.setClass(this, GoogleMapsActivity.class);
startActivity(i);
finish();
}
catch(ClassNotFoundException e)
{
TextView tv = (TextView)findViewById(R.id.google_maps_start);
tv.setText(R.string.not_found);
}
}
}
and AndroidManifest contains the line:
<uses-library android:name="com.google.android.maps" android:required="false" />
The widget works normally in the emulator and in real devices, but there is also a device, where I see "Google Maps not found" message, initiated by ClassNotFoundException
handler. Nevertheless, the same device does have Google Maps on board and they work ok. So the question is what is wrong with my application, or possibly with the specific device, and how to fix the problem?