0

I know there are some questions about this, but none of them helped me.

I'm debugging with a Sony Xperia (API 14) and I always get a white screen with the zoom buttons (+ and -). But I have tested the same code with a Galaxy Nexus and I can see the map.

If it's working in another device but not in mine, I guess it is not an API key problem, permission problem, layout or code problem. I also have checked the GooglePlayServices and is always returning SUCCEED.

This is the layout code:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:map="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >


<fragment 
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    class="com.google.android.gms.maps.MapFragment"/>

</LinearLayout>

This is the java code:

package com.nanonino.realtor;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.maps.MapFragment;

import android.app.Activity;
import android.app.Dialog;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.os.StrictMode;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.ImageView;

public class ByLocation extends Activity {

@Override
protected void onCreate (Bundle savedInstanceState){

    super.onCreate(savedInstanceState);

    //setContentView(R.layout.by_location_list);
    setContentView(R.layout.by_location_map);   

    //if state has a value different from 0...OH OH!!! Problem, you have
    //to tell the user to install GooglePlayService in the device
    int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
    switch (resultCode) {
        case ConnectionResult.SUCCESS: // proceed
            break;
        case ConnectionResult.SERVICE_MISSING:
        case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
        case ConnectionResult.SERVICE_DISABLED:
            Dialog dialog = GooglePlayServicesUtil.getErrorDialog(resultCode, this, 1);
            dialog.show();
    }

}

I have many imports because I have tried everything. But now I know that the problem is with the device, not the code.

Any idea?

trumpetero
  • 153
  • 1
  • 1
  • 12
  • I've got similar problem before, in my case it was due to the wrong date/time of the device. http://stackoverflow.com/questions/15615759/blank-googlemap-on-a-real-android-2-3-device-with-google-api-lv-17/15630541?noredirect=1#15630541 – dumbfingers Mar 28 '13 at 11:48
  • And also make sure you're connected to the internet on the Xperia (sorry, lame comment I know, but just trying to cover all bases). – themanatuf Mar 28 '13 at 11:50
  • -Solved- I have just put a SIM on the device, and now I'm getting a Google Play Service error. It seems that you need to have a data connection, because I was connected by WiFi and it was "ok". Maybe there is another type of user-permition for getting internet services by wifi. – trumpetero Mar 28 '13 at 12:10

0 Answers0