Map Problems

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Map Problems

Postby Kamal » Thu May 28, 2009 8:21 am

[font=Arial] [/font][font=] [/font]
Hi all,

I am using android SDK1.0 and trying to load google map.
I am able to browse maps.google.com site from android emulator so I feel internet may not be the problem.
I also have obtained the Map API key as mentioned in the the document.

My AndroidManifest.xml file looks like this.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="bst.GoogleMap"
android:versionCode="1"
android:versionName="1.0.0">
<uses-permission android:name="android.permission.INTERNET" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<uses-library android:name="com.google.android.maps" />
<activity android:name=".MapsActivity"
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>
</manifest>

main.xml 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 = "012_Xi3bU6NpfpRxR11DEmea0n9wLHPgD1ThJ2w"

/>
</RelativeLayout>


Java Codes :

package bst.GoogleMap;

import android.os.Bundle;

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

public class MapsActivity extends MapActivity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

}

@Override
protected boolean isRouteDisplayed() {
return false;
}
}

As mentioned, this should display Map on map view. But I see only Gids nothing else.

What could be the problem....... :?:

Helps are appreciated...
Kamal
Junior Developer
Junior Developer
 
Posts: 23
Joined: Wed May 27, 2009 11:15 am

Top

Map Problems

Postby Kamal » Thu May 28, 2009 9:29 am

I also would like to add that we have firewall in our office....

after few settings, I am able to browse internet from android emulator..

Can we assume that now there is no internet problem ?

Log file indicates.....

05-28 13:47:58.237: INFO/ActivityManager(51): Start proc bst.GoogleMap for activity bst.GoogleMap/.MapsActivity: pid=651 uid=10024 gids={3003}
05-28 13:47:58.326: INFO/jdwp(651): received file descriptor 13 from ADB
05-28 13:47:58.677: WARN/Maps_Persistence(651): Couldn't find file: /data/data/bst.GoogleMap/files/DATA_Tiles
05-28 13:47:58.917: INFO/MapActivity(651): Handling network change notification:CONNECTED
05-28 13:47:58.917: ERROR/MapActivity(651): Couldn't get connection factory client
05-28 13:47:59.048: INFO/ActivityManager(51): Displayed activity bst.GoogleMap/.MapsActivity: 924 ms
05-28 13:47:59.647: WARN/AndroidHttpConnectionFactory(651): IOException in HttpClient: Host is unresolved: http://www.google.com:80
05-28 13:48:00.156: DEBUG/dalvikvm(651): GC freed 5140 objects / 336944 bytes in 78ms
05-28 13:48:00.207: WARN/AndroidHttpConnectionFactory(651): IOException in HttpClient: Host is unresolved: http://www.google.com:80
05-28 13:48:00.457: WARN/AndroidHttpConnectionFactory(651): IOException in HttpClient: Host is unresolved: http://www.google.com:80
05-28 13:48:00.717: WARN/AndroidHttpConnectionFactory(651): IOException in HttpClient: Host is unresolved: http://www.google.com:80
05-28 13:48:00.986: WARN/AndroidHttpConnectionFactory(651): IOException in HttpClient: Host is unresolved: http://www.google.com:80


Regards,
Kamal
Kamal
Junior Developer
Junior Developer
 
Posts: 23
Joined: Wed May 27, 2009 11:15 am

Postby guitarbaka » Thu May 28, 2009 8:01 pm

I believe your problem lies where you put your INTERNET permissions. I am not currently at my computer to view my code, but I was having the same problem. The best way to put permissions on Manifest is to actually click on the permissions tab and add it there automatically. Try that. If you still need help, later I will go home and take a look at my code and send you how my manifest looks.
guitarbaka
Junior Developer
Junior Developer
 
Posts: 13
Joined: Fri May 22, 2009 2:19 am
Location: Pomona, CA

Reg: manifest File

Postby Kamal » Fri May 29, 2009 6:00 am

Hi Guitarbara....

I checked with the manifest file. I have added the permission from the permission tab...

But still the problem exists....... :sad:
Kamal
Junior Developer
Junior Developer
 
Posts: 23
Joined: Wed May 27, 2009 11:15 am

Postby guitarbaka » Fri May 29, 2009 6:06 am

Here is my manifest for android 1.5 sdk. Should work the same as yours. You can see the differences between mine and yours and mine works.

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

Try it this way, you can see the <uses-library ..... is outside the activity, but inside the application
Also you note that uses permissions is inside manifest but outside everything else.
This is the only thing I can think of that happened to me. I am using Ubuntu as my OS.
guitarbaka
Junior Developer
Junior Developer
 
Posts: 13
Joined: Fri May 22, 2009 2:19 am
Location: Pomona, CA

Postby Kamal » Fri May 29, 2009 6:13 am

Hi guitarbara..........

Thanks for the reply.....

Well as i can see in my manifest file too, the uses permission is just under manifest heading(outside of all others) and uses library is under application heading(outside activity)...

I did change some settings in the emulator, Changed APN settings with my proxy and port... By doing so i am able to browse from emulator... I hope i have done right.....
Kamal
Junior Developer
Junior Developer
 
Posts: 23
Joined: Wed May 27, 2009 11:15 am

Top

Problem Solved

Postby Kamal » Mon Jun 01, 2009 8:32 am

Hi all,
The problem was due to internet proxy......
I connected the internet directly using my mobile phone and it worked....
Kamal
Junior Developer
Junior Developer
 
Posts: 23
Joined: Wed May 27, 2009 11:15 am

Postby guitarbaka » Mon Jun 01, 2009 4:17 pm

thats great, Im glad you resolved your problem.
guitarbaka
Junior Developer
Junior Developer
 
Posts: 13
Joined: Fri May 22, 2009 2:19 am
Location: Pomona, CA

Re: Map Problems

Postby jimmy » Tue Jun 23, 2009 8:53 pm

hi i m using sdk1.0 and adt0.8.0. now i have a problem that map is not display in my emulator screen please help me. and yes i am also take a permission on internet.


this is my GoogleMaps.java file
package net.learn2develop.GoogleMaps;

//import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
//import com.google.android.maps.MapController;
import com.google.android.maps.MapView;

import android.os.Bundle;

public class GoogleMaps extends MapActivity
{
MapView mapView;
// private MapController mc;

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

mapView = (MapView) findViewById(R.id.mapview1);
// mc = mapView.getController();
mapView = new MapView(this,"0SPUa3va0ay5WY-8vrMy-Vy2B_z5plRiNneEviw");
//String coordinates[] = {"40.747778", "-73.985556"};
//double lat = Double.parseDouble(coordinates[0]);
//double lng = Double.parseDouble(coordinates[1]);

//GeoPoint p = new GeoPoint(
// (int) (lat * 1E6),
// (int) (lng * 1E6));

//mc.animateTo(p);
//mc.setZoom(17);
//mapView.invalidate();
}

@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}


this is my main.xml file


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<com.google.android.maps.MapView
android:id="@+id/mapview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="0SPUa3va0ay5WY-8vrMy-Vy2B_z5plRiNneEviw" />

</LinearLayout>


and this is my android manifest.xml file


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.learn2develop.GoogleMaps">
<application android:icon="@drawable/icon"
android:label="@string/app_name">
<activity android:name=".GoogleMaps"
android:label="@string/app_name" android:permission="android.permission.INTERNET">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />

</intent-filter>
</activity>
</application>

<uses-permission
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="android.permission.INTERNET">
</uses-permission>

<uses-permission
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="android.permission.ACCESS_COARSE_LOCATION">
</uses-permission>


<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
</manifest>

please reply fast.
jaimik
jimmy
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Jun 23, 2009 8:29 pm
Location: india

Re: Map Problems

Postby Tunwiir » Tue Aug 11, 2009 3:02 pm

hey there,
I am wondering if anyone could tell me how to get the Maps API Key. i know you have to generate an MD5 fingerprint and then get the key.
my problem is i dont know how to get the fingerprint. I am using Mac.
I am new to both android and Mac so please bear with me.
Your help and time is much appreciated
Regards
Tunwiir
Tunwiir
Freshman
Freshman
 
Posts: 6
Joined: Tue Aug 11, 2009 2:52 pm
Location: Manchester

Postby arams » Wed Aug 12, 2009 6:08 am

arams
Experienced Developer
Experienced Developer
 
Posts: 89
Joined: Fri May 08, 2009 7:45 am

Postby Tunwiir » Wed Aug 12, 2009 2:23 pm

Hi Arams,
Thanks very much for your help. I have found the resource very useful indeed. I managed to generate the key and i am working through the tutorial now.
I'll give u a shout if m stuck :)
Thanks again for your time
Tunwiir
Tunwiir
Freshman
Freshman
 
Posts: 6
Joined: Tue Aug 11, 2009 2:52 pm
Location: Manchester

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 3 guests