Android: Google Maps Android API: Authorization failure -


when app tries use google maps api, following logcat error try access google map api data (scroll right see stuff!):

02-02 15:39:35.329 23868-24511/com.somepackage.name e/google maps android api: authorization failure.  please see https://developers.google.com/maps/documentation/android/start how correctly set map. 02-02 15:39:35.339 23868-24511/com.somepackage.name e/google maps android api: ensure following correspond in api console:                                                                                             api key: ai~~~~~~~~~~~~~~~~~~~~~~~~~~zwmi​                                                                                             package name: com.somepackage.name                                                                                             certificate fingerprint: 50:~~~~~~~~~~~~~~~~~~~~:d5 

here image of google developers support console fingerprint , api key (and yes, match!). have waited google servers update (5 minutes according dox; have waited hours).

enter image description here

and here project's primary androidmanifest.xml (edited brevity):

<?xml version="1.0" encoding="utf-8"?> ... <!--  following 2 permissions not required use  google maps android api v2, recommended. --> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.access_fine_location" />  <application     ...     <!--the key use google's map api -->     <meta-data         android:name="com.google.android.geo.api_key"         android:value="aiz~~~~~~~~~~~~~~~~~~~~~~~~~~~~wmi​"/>      <activity     ...     </activity>     ... </application> 

i have premium support account google, have been unable contact them far. have idea why i'm getting authorization failure?

after many hours, figured out answer plus 1 important gotcha!

situation

i need re-explain details didn't know important paramount.

i inherited project, history unknown. program used free version of google maps, worked fine. since large company, went ahead , paid full premium subscription service. programmers added new libraries , made few code modifications use libraries.

but still used original (free) authorization key. caused google's servers continue treat data if free version.

no 1 noticed because free goole maps api has issues after number (2500?) of api calls in 1 day. our traffic became high enough issue. (after limit, google api sends error message instead of data.)

consequently changes made seemed have no effect. , changing keys in code caused authentication errors (see in question).

solution

i had make new authentication key using new premium libraries , console. changed google server of course caused versions of app in existence cease functioning!

the new authentication key, placed in manifest, gets recognized google api , works, yay! still need release new version in google store.

gotcha #1

the androidmanifest.xml command listed in docs did not work:

    <meta-data         android:name="com.google.android.geo.api_key"         android:value="ai............................mi​"/> 

this correct name works:

    <meta-data         android:name="com.google.android.maps.v2.api_key"         android:value="ai............................mi​" /> 

gotcha #2

but when testing, still got sorts of errors. why? because android devices maintain caches of authentication keys. clearing data (or better, uninstalling) cleaned out caches. now works, yay.

moral: when dealing api keys, authentication, certificates, , anything similar, uninstall every time! :)


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -