Showing error in mapview Android - android

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.

Related

Google maps on Android not working on app but demo is fine

I cannot get Google Maps to work on my app.
I see a blank screen; no grids show, only the google logo and the +/- zoom buttons.
What I have done:
I have the "Google Maps Android API v2" API enabled
I have added my project along with the demo project to the API credential list on Google console
I've also added the required permissions for Internet, location, com.google.android.providers.gsf.permission.READ_GSERVICES.
Even added the "MAPS_RECEIVE" permission as some posts suggested
Also added the 'meta-data' google_play_services_version
Since the demos are working, I literally copied MultiMapDemoActivity and its files into my project and tried opening map, to no avail.
The problem may be linked to this issue. However, it seems like they can't get map to work at all.
Here is the interesting bit that I noticed, I usually get this:
10-02 12:29:20.376: D/REQUEST(5826): Connection opened to:https://clients4.google.com/glm/mmap/api
10-02 12:29:20.376: D/REQUEST(5826): Open Connection
Followed by this:
10-02 12:21:45.361: D/REQUEST(5826): DRD(80): 62|132
10-02 12:21:45.361: D/REQUEST(5826): Close
10-02 12:21:45.361: D/REQUEST(5826): Error processing: com.google.maps.api.android.lib6.b.d#42caa7b8 not retrying
10-02 12:21:45.361: D/REQUEST(5826): Retrying: com.google.maps.api.android.lib6.gmm6.c.a#4296a530
Also, not sure if this is relevant, but as soon as I click to open the map, or click on the map after it has opened and is showing a blank view, I see this:
10-02 13:03:32.978: E/DatabaseUtils(15468): Writing exception to parcel
10-02 13:03:32.978:/DatabaseUtils(15468): java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this
requires android.permission.INTERACT_ACROSS_USERS_FULL
EDIT #1
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
EDIT #2
Also, the declared package name was com.A.B.C (the manifest); whereas the activities of my project had the structure of com.A.B..
I have since updated my project structure to match that of the manifest, but I still see the same errors as before, nothing changes. I'm really at sea here, since I cannot understand what could be going wrong here.
Some help to resolve this will be appreciated, thanks!
It turns out that I had read n-1 questions regarding this issue here. Finally, after continuous searching everywhere, I stumbled upon the answer here by #Jack.
Basically the line:"HttpsURLConnection.setDefaultSSLSocketFactory(...)" was the culprit in my code. I commented it out and everything worked fine.
NOTE: I have not tried to keep the line of code and modify it to make maps work yet. If I need/do it, I'll post a comment.
You need to add your SHA1 fingerprint to the public API access.
Go to eclipse > preferences. Android > build and copy your default eclipse SHA1 fingerprint.
Now go to https://console.developers.google.com select your app, 'APIs and auth' > 'credentials' > and click on 'Edit allowed android applications' put your SHA1 figerfirnt like that:
XX:XX:XX:XX:XX...XX;com.your.pakage.app
What about your google key? This line in the Manifest file:
<meta-data android:name="com.google.android.maps.v2.API_KEY"
....
I am also struggling with such behavior constantly. The first thing you want to verify in such situations is that your key from debug.keystore file is indeed the one that you registered with Google. This key will be used when you are debugging your application locally.
Note, however, you will need another keystore file when you release your application. At the time of signing, you should create another keystore, and register it too with Google.
I had this problem too and it took me so much hours to resolve it, at last I've done these steps and it worked finally!
Do the same steps as it followed here https://developers.google.com/maps/documentation/android/start
Use the debug certificate fingerprint if you're testing your project instead of the release certificate which you use when you install your app in the play store.
Don't forget to add the value of the Google API and replace the "API_VALUE" with it.
Change your project build target into Google APIs: Project>properties>android>target.
Hope this helps..
These are the permissions you need according to Google documentation:
<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"/>
I recommend you to include this too:
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
Add those in your manifest file
<permission
android:name="xxx.xxxx.xxxx.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="xxx.xxxx.xxxx.permission.MAPS_RECEIVE" />
<uses-permission android:name="xxx.xxxx.xxxx.permission.READ_GSERVICES" />
replace xxx.xxxx.xxxx with your package name

Osmdroid - Unable to load a map on-line

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

google maps not showing on android device

Android device only shows tiles for map. Seems to be widely reported. I followed the instructions of this link:
https://developers.google.com/maps/documentation/android/start
I did the following:
1) In Eclipse, I signed in Release Mode. I select File > Export. Selected Export Android Application, and clicked Next. Created a new keystore. Then uploaded the apk to google play.
2) Android app worked on device but map didnt show. It just showed tiles.
3) So I followed the instructions in the link above.
4) I located the keystore file that I created above. My keystore is called ziggy.keystore and alias is ziggy keystore.
5) I ran this in terminal on Mac OSX:
keytool -list -v -keystore ziggy.keystore -alias ziggy\ keystroke
6) The above command produces output that includes a line that contains the certificate's SHA-1 fingerprint. The fingerprint is the sequence of 20 two-digit hexadecimal numbers separated by colons.
7) Now that I have the signing certificate fingerprint, I created a project for the application in the Google APIs Console. In a browser, I navigated to https://code.google.com/apis/console/
8) I clicked Create Project. I named it API project. I see a list of APIs and services in the main window.
9) I scroll down until I see Google Maps Android API v2. To the right of the entry, I clicked the switch indicator so that it is on. I agreed to the terms of service and clicked accept.
10) In the left navigation bar, I clicked API Access. In the resulting page, I clicked Create New Android Key. In the resulting dialog, I entered the SHA-1 fingerprint, then a semicolon, then the application's package name.
11) I copied the API key. I opened my application's manifest, contained in the file AndroidManifest.xml. And add the following element as a child of the element, by inserting it just before the closing tag :
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="your_api_key"/>
* Note that I used my real api key.
12) I added this as well:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<permission
android:name="com.otl.AndroidRemoteApp1.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.otl.AndroidRemoteApp1.permission.MAPS_RECEIVE"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
13) Then in my ShowMapActivity.java:
super.onCreate(savedInstanceState);
setContentView(R.layout.show_map);
mapView = (MapView) findViewById(R.id.mapview);
myMapController = mapView.getController();
mapView.setBuiltInZoomControls(true);
Drawable marker=getResources().getDrawable(android.R.drawable.star_big_on);
...
14) Then in my show_map.xml file:
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:state_enabled="true"
android:apiKey="my_api_key"
/>
* I replaced my_api_key with the real key.
So I followed all the instructions and then when I downloaded the app on an android device, it did not show the map. It just shows the tiles thing, which has been reported before.
I'm not sure what step I missed to get this to work.
The configuration steps looks good to me.
But i think you are interacting with the library in an old fashioned way. I know the documentation says that the MapView can be added and controlled to the Activities, but i would try to use the new GoogleMap and MapFragment approach. I'm not really sure how supported the "extending MapActivity and handling MapView" are on the V2 of the library
Here's the documentation for it: https://developers.google.com/maps/documentation/android/map#add_a_map_to_an_android_application
Have you tried it?
Thanks for the very thorough description. The issue is that you are using the setup process f for the Android v2 API but the classes from the v1 API. Since v1 is now deprecated it is highly advised that you use v2. If you follow the rest of the instructions about building with Google Play services you should be OK.

Tasks API and OAuth 2.0 on Android sample

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.

Unable to show Google Maps using WiFi behind a proxy

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

Categories

Resources