tags:

views:

43

answers:

2

hi,i am unable to view maps on the emulator. I am under proxy internet connection, I also set the proxy via GUI and also have set api Key alongwith the perimissions and library.

here's my code:

package com.example.MyMapActivity;
import org.apache.http.HttpHost;
import org.apache.http.conn.params.ConnRoutePNames;
import org.apache.http.impl.client.DefaultHttpClient;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;

public class MyMapActivity extends MapActivity {

private MapView mapview;
private MapController mapcontroller;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    DefaultHttpClient client = new DefaultHttpClient();

    String proxyHost = android.net.Proxy.getHost(this);
    if (proxyHost !=null) {
      int proxyPort = android.net.Proxy.getPort(this);

      HttpHost proxy = new HttpHost("*********", ***);

      client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
    }
    //mapview = (MapView)findViewById(R.id.mapview);
}

@Override
protected boolean isRouteDisplayed() {
    // TODO Auto-generated method stub
    // this method must return true if your app returns driving directions , else return false
    return false;
}

}

The Layout file

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.google.android.maps.MapView 
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
 android:apiKey="***********">     </com.google.android.maps.MapView>

The mainfest file

<?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.example.MyMapActivity"
  android:versionCode="1"
  android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
    <uses-library android:name="com.google.android.maps"></uses-library>
    <activity android:name=".MyMapActivity"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

</application>
<uses-sdk android:minSdkVersion="7" />

<uses-permission android:name="android.permission.INTERNET"></uses-permission> 
<uses-permission android:name ="android.permission.ACCESS_COARSE_LOCATION"/>

A: 

If the emulator does not have Google Maps installed on it you can't use MapView or any other maps related activity.

You need need to make sure you create an emulator image which has the Google APIs available.

Al Sutton
I think you are wrong. My emulator has a Maps app and my mapviews are working fine on the emulator.
Janusz
The default emulator does not have Maps installed. Only emulators created to support the Google APIs have Maps available.
Al Sutton
A: 

If the mapview is displayed but no maptiles are loaded it could be this bug ( Google Maps fails via mandatory web proxy) that is reported in the bug database from google. Read all the information about the issue carefully. It is very possible that this is an error on your side that you will never discover because you think it is googles fault.

Test the app somewhere without a proxy to confirm that it is working there.

Janusz
thanks , i had already gone through that from a previous similar thread,and i had tried most of things mentioned there, so has there been no solution to it till now,i.e one can't run the Maps app in proxy?
pranay
Also when i am running the Maps app in built on the emulator, it shows Loading.. and when i press back button it shows a message that:"Wrong remote strings version. GMM Server must be hosting:/strings_remote_53314944.dat"
pranay
i tested the app without proxy and it is working fine , so the Maps do not work under proxy
pranay