Я использую maps api v2 в приложении для Android, которое поддерживает 2.3.3, и я установил setMyLocationEnabled (true), конечно, у меня есть кнопка, которая отлично работает на желейных бобах, но не работает на 2.3.3.
вот как я назвал карту:
private void setUpMapIfNeeded() {
// Do a null check to confirm that we have not already instantiated the map.
if (mMap == null) {
// Try to obtain the map from the SupportMapFragment.
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
// Check if we were successful in obtaining the map.
if (mMap != null) {
setUpMap();
}
}
}
private void setUpMap(){
mMap.setMyLocationEnabled(true);
if(ttdBranch!=null){
mMap.addMarker(new MarkerOptions()
.position(new LatLng(ttdBranch.getLatitude(), ttdBranch.getLongitude()))
.snippet(getResources().getString(R.string.branch) + "\n" + ttdBranch.getName()));
LatLng pos = new LatLng(ttdBranch.getLatitude(),ttdBranch.getLongitude());
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(pos, 14));
}
}
вот манифест:
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<permission android:name="*******.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="*******.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_ttd_petales"
android:label="@string/app_name"
android:theme="@style/Holo.Theme.Light" >
<activity
android:name="*******.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="*******.BranchesMapActivity" />
<activity android:name="*******.BranchDetailActivity"/>
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="*******"/>
Я убедился, что на телефоне включен датчик местоположения, и он работает в приложении Google Map, но не в моем приложении.
Любая помощь ?
Спасибо.