I’m using the osmdroid library to use openstreetmaps in my android application, but I’m unable to load the maps on-line, using wifi.
If I make de manual download of the maps (mbtiles file) and place it in the osmdroid filder in the device it works fine and they are loaded by my application, but if I want that my application loads the maps from the web in real time it doesn´t work and the maps are not loaded.
In Logcat I get the following warning:
"Problem downloading Maptile: /4/8/8 HTTP/1.1 403 Forbiden"
I have the following permissions in Manifest:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
This is the code I use to load the maps with the osmdoid:
myOpenMapView = (MapView)findViewById(R.id.openmapview);
myOpenMapView.setBuiltInZoomControls(true);
myMapController = myOpenMapView.getController();
myMapController.setZoom(4);
Can anyone help me?
Thanks
The issue mentionned by LordRaydenMK has been fixed in osmdroid 4.1.
So if this is the issue you have, you just have to update your osmdroid lib to the latest version.
The default Apache HttpClient user-agent was recently banned from accessing tile.openstreetmap.org (server returns 403). As a result,
the Mapnik provider is no longer serving any tiles for osmdroid.
OpenStreetMap's tile usage policy (
http://wiki.openstreetmap.org/wiki/Tile_usage_policy ) says that a
"Valid User-Agent identifying application" must be sent. The current
user-agent osmdroid sends when it downloads a tile is
"Apache-HttpClient/UNAVAILABLE (java 1.4)" which is pretty generic.
I've created a patch that will send a user-agent that is more
compliant with OSM's tile usage policy. The new user-agent is
"osmdroid ([package name])" where [package name] is the package name
of the application using osmdroid.
The patch can be found here: http://pastebin.com/kxBh1gQ5
The patch is not very pretty, but it does its job.
Source: https://code.google.com/p/osmdroid/issues/detail?id=515
Related
I'm currently developping a phonegap app with backbone but i'm not able to fetch my data from a cross domain website.
Testing the app on android gives me no results but testing it in chrome with "chromium-browser --disable-web-security" gives me a success response with the data I need.
Using phonegap I added the following lines of code:
config.xml
<access origin=".*"/>
AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
json
[
{
"id":"918",
"merk":"Yamaha",
"type":"YZF R1"
...
Its a valid json file.
My backbone collectionName.fetch() doesn't work, and doing a simple ajax call isn't working either inside the app.
Is there any reason why I cannot fetch my data from the api in my phonegap android app!
I really could use some help
cheers!
From the file:// protocol there should be no limitations regarding same-origin, see here: http://en.wikipedia.org/wiki/Same_origin_policy#Corner_cases_and_exceptions
However it could be the server doesn't allow access to requests originating from file:// url's, check your server log. To doublecheck you could also access a publicly accessible webservice like Google Geocoding (see comment).
Edit: this is actually wrong...
This likely is because cross domain is only allowed within the same protocol. Since your phonegap app runs from file:// this introduces problems when connecting via http(s):// protocol.
I want to display three pin points in the mapview and i had checked the internet connections in the emulator and even i had used the key for displaying mapview but it's showing error couldn't get connection factory client.
Basic info for displaying map in your Android Application.
1. Your application build platform is Google-Api not Android-Api.
2. put <uses-library android:name="com.google.android.maps" /> in Application tag in
Android manifest file.
3. Your mapview activity must extend MapActivity.
4. You have a your system specific map-key for debug version of application.
Try to add these two Permissions also.
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
It can be because of Map getting Zoom it. And you can refer to this LINK.
i'm very new to android devolopment
i tried to run the sample project given in this example
http://code.google.com/p/google-api-java-client/source/browse/tasks-android-sample/src/main/java/com/google/api/services/samples/tasks/android/TasksSample.java?repo=samples
but when i run it, it gives a force close error. after a messing around i figure that it has only list activity not activity class as others. why? how to fix it?
. my idea is to create a android software which i can push tasks from the server to the app then the app will add those as tasks in the phone? any sample apps like that?
Maybe you forgot to set the permission for Oauth?
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
New Task sample required Google Play Service Library to run you need to set up it and added into build path of your application.
I have created a simple app which shows a Google Map. I am testing it on a HTC Desire S and I am using only WiFi network behind a proxy. But it is not showing anything, only map tile are shown in the screen. Even the default map application is not working. It shows the error message that
"Network Failure : wrong remote string version.GMM server must be hosting:/ string_remote_no-remote-strings."
My Map API key is correct and I have added the following permissions in the manifest file:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
How do I solve this problem?
Are you sure
you extended MapActivity?
your API Key is correct?
Apparently if you are using a proxy, and have set that in your APN, then your AVD cannot load any application that is using the map, neither the pre-installed one, nor any created by you.
Check http://code.google.com/p/android/issues/detail?id=3764#makechanges
I am using the google map API in a very basic app. But the problem is that on running the app, I only see the grid and the map controls...the map doesnt even load in the virtual device.
I have internet running in the device...the browser seemed to be loading just fine, so it isnt an internet problem.
Also, i did obtain an API key after registering for the map API and included that in my main.xml file...but still it doesnt show the map...just grids.The permissions for using the internet are also granted in the manifest file.
Im using the Google API level 8.Any idea how to fix this?
thx.
EDIT 1: Can anyone please help me out with this...really need help :(
EDIT 2: Well I found the following error in my LogCat:
Sending checkin request
Checkin failed: https://android.clients.google.com/checkin (request #0)
org.apache.http.conn.ConnectTimeOutException: Connect to /209.85.231.100:44 timed out
So basically my connection is timing out...im not really sure why...could anyone provide some fix for this plz?( but the AVD's browser is able to work perfectly, no time out problems..sites are able to load properly)
Also, the pre-installed maps application is showing the following error:
**Network Failure** Wrong remote strings version.GMM Server must be hosting:/strings_remote_533149424.dat
If you know any way i could fix this, it would be extremely helpful...
Thx.
Apparently if you are using a proxy, and have set that in your APN, then your AVD cannot load any application that is using the map, neither the pre-installed one, nor any created by you.
Reference: http://code.google.com/p/android/issues/detail?id=3764#makechanges
Unfortuantely there is no solution for this (yet).
Thx to all who helped :)
PS: If any1 found a solution using the proxy...or any other way to fix this...do post here..
You should not make your network(proxy) settings in your emulator or device. Just open your network settings in your PC. Then go the properties. you will find the list of items in your connections. go to IPV4 and set your default gateway and DNS server.
I faced the same error
**Network Failure** Wrong remote strings version.GMM Server must be hosting:/strings_remote_533149424.dat
Then i followed the above steps. I got the output.....Just check out and reply....
Make sure that these permissions are in your manifest file, outside the closing application tag:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Is your emulator connected to the internet? some times the emulator fails to connect to the internet when it boots, you should see a 3g sign on your notification bar.
Seen this issue posted many times, and have written up a really easy tutorial which has helped folk such as this previous question on SO
It generally tends to be one of 3 issues :
API key is incorrect
You are using the standard Android emulator and not the Google APIs.
You have extended Activity instead of MapActivity
Hope this helps.
This is most likely due to the API-key being wrong. Make sure you're using the correct API-key. (The key will be different for your debug certificate (keystore) and the certificate you use to sign the APK before you publish it to Android Market).
To generate an MD5 fingerprint of the debug certificate, first locate the debug keystore. By default, build tools create the debug keystore in the active AVD directory. The location of the AVD directories varies by platform:
Windows Vista: C:\Users\.android\debug.keystore
Windows XP: C:\Documents and Settings\.android\debug.keystore
OS X and Linux: ~/.android/debug.keystore
See http://code.google.com/android/add-ons/google-apis/mapkey.html for more details.