La google map ne s'affiche pas.
Bonjour à tous.
Je suis entrain de développer une application de localisation des pharmacies de mon pays.
Donc j'utilise l'API GoogleMap pour afficher une pharmacie sur une map.
Quand je suis en dév, la map s'affiche bien. par contre quand j'installe l'appli via le store la map ne s'affiche.
voici mon manifest
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pharma.app.app_pharma">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<!-- <uses-permission android:name="android.permission.READ_PHONE_STATE" /> -->
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<!--
ATTENTION: This was auto-generated to add Google Play services to your project for
App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information.
-->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<!--
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
-->
<activity
android:name=".map.MapsActivity"
android:label="@string/title_activity_maps"
android:screenOrientation="portrait" />
<activity android:name=".main.PharmacyActivity" />
<activity
android:name=".main.PharmacyOfLocalityFragment"
android:screenOrientation="portrait" />
<activity
android:name=".main.DrawerActivity"
android:label="@string/title_activity_drawer"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".main.AdminListPharmacyActivity">
</activity>
</application>
</manifest> |
le code que j'utilise pour afficher la map
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| @Override
public void onMapReady(GoogleMap googleMap) {
try{
mMap = googleMap;
mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
UiSettings settings = mMap.getUiSettings();
// Showing / hiding your current location
mMap.setMyLocationEnabled(true);
// Enable / Disable zooming controls
settings.setZoomControlsEnabled(true);
// Enable / Disable my location button
settings.setMyLocationButtonEnabled(true);
// Enable / Disable Compass icon
settings.setCompassEnabled(true);
// Enable / Disable Rotate gesture
settings.setRotateGesturesEnabled(true);
// Enable / Disable zooming functionality
settings.setZoomGesturesEnabled(true);
settings.setTiltGesturesEnabled(true);
settings.setTiltGesturesEnabled(true);
// Add a marker in Sydney and move the camera
LatLng point = new LatLng(this._pharmacy.pharmacyLat,this._pharmacy.pharmacyLon);
MarkerOptions options = new MarkerOptions();
options.position(point);
options.snippet(_pharmacy.pharmacyAddress);
options.title(_pharmacy.pharmacyName);
//options.icon(BitmapDescriptorFactory.fromResource(R.drawable.icon));
mMap.addMarker(options);
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(point, 17));
}catch (Exception e){
//Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
}
} |
Merci et bien à vous ;)