i have made an application in which i need to load the google maps. For this i am using the Google API 8 in my application.
i have the following code in my xml file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="fill_parent" android:layout_height="fill_parent"
android:apiKey=" 0x94IPJOQyNBzKMCfF5ks82SpwcbVab3Ixfk_hQ " android:id="#+id/mapview"
android:enabled="true"/>
<!-- home key -->
<!-- 0x94IPJOQyNBzKMCfF5ks82SpwcbVab3Ixfk_hQ -->
<!-- map key for publishing -->
</LinearLayout>
The above key i have obtained by using the MD5 print of the debug.keystore file.
The error that i am getting in the Logcat is :
07-25 22:52:02.167: ERROR/MapActivity(4784): Couldn't get connection factory client
In the .java file for the maps, i have used an overlay to load a set of co-ordinates. The overlay is visible but the map is not visible. What could be going wrong?
thank you in advance.
i was facing the same problem you have mentioned here.. and i know this is really annoying,
There are some important things and steps you must follow to get google maps in you application.
---Make sure that:
1. you got ur API key for google maps is right.
2. you have mentioned INTERNET PERMISSION outside you application tag.
3. you have called google map user library...
even then if you are facing the same problem then i guess you are using some proxy server for your internet. and android application and its emulator dont follow that proxy server.
you need to set proxy for you application.
Right click on you project in Eclipse.
Go to "Run As> Run Configuration "
go to "Target" tab
there is "Additional Emulator Command Line Option"
write your proxy here like this
"-http-proxy http://your-proxy:your-port" without double quotes
it works for me...
but this is only for android application projects... cant use google maps in browser
Do you have allowed permission for connection to internet? Or you see grid lines?
<uses-permission
android:name="android.permission.INTERNET" />
And what I have noticed, you have empty space at the end and beginning of android:key="
There are a couple questions with the same error you are seeing in Logcat:
Couldn't get connection factory client
Couldn't get connection factory client
http://groups.google.com/group/android-developers/browse_thread/thread/94e3d0454612d143?pli=1
They all seem to mention that it is an Google API problem with API versions 8 and 9.
Related
I'm trying to add the Facebook API in my application. I build it in ActionScript3-AIR to proceed an export on iOS/Android and use the GoViral API to apply the connection with Facebook.
After the creation of the application on Facebook Developer, it works on iOS, but not on Android.
When this line is read GoViral.goViral.initFacebook( XXXXXXX ), on Android, the application show a popup which display the Key Hashes Here, the screenshot:
Then, nothing happen. The connexion don't seem to be done and, if I try an authentication with GoViral.goViral.authenticateWithFacebook( "user_likes,user_photos,publish_actions" ) it does nothing. And by that, I really mean nothing in the way that it don't even return the GVFacebookEvent.FB_LOGIN_FAILED event.
I used the "Mail It" button on this popup. Took the hash key and pasted it in the Android section of my application in the Facebook Developer Here, the screenshot:
But, nothing changes and the popup always appears.
After that and by the results of some google research, I've try to make my own Hash Key, helped by some tutorials. The Key has been generated but didn't correct anything about the popup.
So, actually, I'm a little confuse about this issue.
Especially as I've try to put another fake App ID in the initFacebook method : the popup continues to appear. So I wonder if it can really see it.
For information, I created the application project on the Google Developers Console.
The manifest I use to apply the Facebook API is this one :
<uses-sdk android:targetSdkVersion="12"/>
<uses-sdk android:minSdkVersion="8"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application>
<activity android:name="com.facebook.LoginActivity"
android:theme="#android:style/Theme.Translucent.NoTitleBar"
android:label="Login"/>
</application>
Thanks a lot to help me to fix this issue.
------ EDIT ------
I found the problem about the Debug Pop-up with the Hash Key. It was relative to the GoViral API which ( I didn't know this ) has two version : One normal and one for the debug which always makes appear the hash key in a pop-up at connection.
The Facebook connection still not working, but it's sound to be another problem so I can say this problem is solved.
I've found the solution which is way simple than I imagined. In the sources of GoViral, there was two ANE, I used the one which was makes for debug. It makes appear the popup to give us the hashkey. After what, we have to put the other ane to make it work.
I accidentally made my package com.example.appname so when I tried to publish it, it wouldn't go through. I changed the package name to myname.app1.appname and everything works the same except my maps implementation. I'm using v2 and it worked before I changed my package but now the map is just a white screen with google in the corner and zoom buttons. The log cat says: E/Google Maps Android API(18983): Authorization failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
I've followed every guide I could find, and read every single question that had anything to do with this, nothing is fixing it.
Map xml
<fragment
android:id="#+id/the_map"
android:layout_width="match_parent"
android:layout_height="450dp"
android:name="com.google.android.gms.maps.MapFragment"
map:cameraTargetLat="43.804871"
map:cameraTargetLng="-79.137248"
map:cameraTilt="45"
map:cameraZoom="14"/>
Map java
GoogleMap googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.the_map)).getMap();
Go to Google Developers Console (https://cloud.google.com/console/)
Open [APIs & auth] - [Credentials] in the left tab
Check the table captioned "Key for Android applications" in "Public API access"
You should see a pair of your fingerprint and package name which you entered before. Click on "Edit allowed Android applications" and change the package name.
I'm close to finish my first app so I change its name and the corresponding packages. To do so, I used the Android Tools from Eclipse and everything works after one or two attemps (there where a couple of things that I had to change manually), but in general, following the comments from this response, there were not further problems. Except for the Google Maps. Now they are not being displayed anymore and I'm getting the following error:
Google Maps Android API(12251): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
I know that there is no connection problem because I'm getting other kind of info from the internet and because the following sentence is true:
int availabilityCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
if(availabilityCode == ConnectionResult.SUCCESS){
The first thing that I did was to go to the Google API and change the package name in the place where you generate the key to make it match the new one. That didn't work, so I deleted the key and created a new one. I pasted the new API key in the Android Manifest but it is not working. Any clues? I'm missing any steps?
In the manifest I still have the needed permissions set, like
<permission
android:name="com.alvarosantisteban.pathos.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
etc.
I think it was a combination of the three things commented here:
That the api key was not valid anymore (but when I posted the question, I already had that done, as I mentioned on it)
But specially that I had to clean the data. I actually deleted the app, because, thanks to the help of android_hungry I went to check my apps and saw that my app appeared two times, one with the maps workings and the other one, the one that is on my desktop as a shortcut, not.
Additionally, it might have happened what silver_man mentioned, I'm not sure.
Thanks to all for the help. :)
You have to create a new api key, as the fingerprint is made from your package name. https://developers.google.com/maps/documentation/android/start?hl=es#obtaining_an_api_key
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.
I am using 2 map Activities. do i want to register multiple Map APi key for each? Now I am getting this exception:
06-16 18:49:41.498: INFO/MapActivity(11067): Handling network change notification:CONNECTED
06-16 18:49:41.498: ERROR/MapActivity(11067): Couldn't get connection factory client
I googled about this exception. It concludes that must be a API Key Problem? Is that true? Why it happens?
This is my code for mapview tag:
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android" android:id="#+id/mapview_id"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:clickable="true" android:apiKey="my_api_key" />
i got this exception while creating the object for the mapview iteself. That is:
MapView mv=(MapView)findViewById(R.id.mapview_id);
I would guess that you are using the API Key for the wrong certificate.
If you are using Eclipse and just click on run on emulator Eclipse will sign your program with a debug certificate and run it. For publishing to the market you need to create your own certificate. The API Key you got from google can be used in every application that uses the certificate that you used for obtaining the key.
That means if you want to see the map in the debug environment you have to get a key with the debug certificate and before publishing the app to the market you need to change the API Key to the one obtained with your signing certificate.
Further help would need a more detailed explanation on what exactly is not working.
You can use one single key for several map activities...
Without a snippet of code I/we can't find any source of error.