like the title says I'm using google maps api v2 and it works on my avd but not on my real device (on my device its just blank)
I found many questions on this same topic but none of those were helpful to my case
any ideas? oh I almost forgot when I run it with the emulator the only error that I get its
"failed to find provider info for com.google.settings"
I already tried with getting a new api key, keystone, uninstalling the app from my device before installing it again... dont know what else.
thank you for at least reading this
EDIT: Im using a Lg g2 dont know if it helps
EDIT2: Manifest, mapa.java and xml
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="Login.cyclingcenter"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.ViBRATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="Swipe"
></activity>
<activity
android:name="Login"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Goolge Maps API Key -->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBtOk02dBY98C7S8BILmMyLLkMbUh8-jLs" />
<meta-data
android:name="com.google.android.gms.version"
android:value="6171000" />
</application>
package Login.cyclingcenter;import android.location.Location;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.OnMyLocationChangeListener;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.model.LatLng;
public class Mapa extends Fragment {
MapView mMapView;
private GoogleMap googleMap;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View mapa = inflater.inflate(R.layout.fragment_map, container, false);
mMapView = (MapView) mapa.findViewById(R.id.mapView);
mMapView.onCreate(savedInstanceState);
establecerMap();
return mapa;
}
public void establecerMap(){
if(googleMap==null){
googleMap = mMapView.getMap();
}
else{
//configuración mapa
configuraMap();
}
}
public void configuraMap(){
//vista normal, puede ser satelite e hibrido
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
//establezco mi posicion en el mapa
googleMap.setMyLocationEnabled(true);
// Asigno un nivel de zoom
CameraUpdate ZoomCam = CameraUpdateFactory.zoomTo(14);
googleMap.animateCamera(ZoomCam);
// Establezco un listener para ver cuando cambio de posicion
googleMap.setOnMyLocationChangeListener(new OnMyLocationChangeListener() {
public void onMyLocationChange(Location pos) {
// TODO Auto-generated method stub
// Extraigo la Lat y Lon del Listener
double lat = pos.getLatitude();
double lon = pos.getLongitude();
// Muevo la camara a mi posicion
CameraUpdate cam = CameraUpdateFactory.newLatLng(new LatLng(
lat, lon));
googleMap.moveCamera(cam);}});
}
@Override
public void onResume(){
super.onResume();
mMapView.onResume();
}
@Override
public void onPause(){
super.onPause();
mMapView.onPause();
}
@Override
public void onDestroy(){
super.onDestroy();
mMapView.onDestroy();
}
@Override
public void onLowMemory(){
super.onLowMemory();
mMapView.onLowMemory();
}
}
XML
<?xml version="1.0" encoding="utf-8"?><com.google.android.gms.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:apiKey="AIzaSyBtOk02dBY98C7S8BILmMyLLkMbUh8-jLs"/>
Are you sure, your app is using needed permissions? Like this:
<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"/>
Following this basic guide.
If your app working on AVD but not on device - this can be reason.
I found the solution and it was that Google uses an api key for debug and one for release and since I was using my own device it is consider as a release even though I'm just testing (google doesnt know that haha), that's it its just another key.