Reputation: 3574
I have developed an android app for my company, where I have introduced a map in a fragment.
The app works fine on my phone, but when providing this app to other fellow workers, in their phones the map is not showing, it appears the focus buttons and the Google logo, but that's it, no map.
layout
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
class="com.google.android.gms.maps.SupportMapFragment"/>
manifest
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- The following two permissions are not required to use
Google Maps Android API v2, but are recommended. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
...
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyArrfA3PQ9kVcwucUGZCoc9yMUC9wc2g_4"/>
Fragment
/*Try to obtain the map from the SupportMapFragment*/
mMap = ((SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
Upvotes: 1
Views: 62
Reputation: 145
In Google Developer API Console
Now use this API key your project
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/common_map_api_key"/>
Upvotes: 0
Reputation: 145
it's a debug key problem. you must use a release key. With version 2 API's you can use the same key for release and debug. In your google api's console edit your allowed android apps and on each line put your debug/release key, and then your app name. You can use multiple lines, then it will work with both keys.
Upvotes: 2