简体   繁体   中英

Google Maps API error: RefererNotAllowedMapError in android device

I'm trying to show javascript Google's map in android device using ionic framework. Map was shown successfully in browser but not in Android device. Error receiving in Android is

"Your site URL to be authorized: file:///android_asset/www/index.html#/map"

But I've added below two URLs already in allowed address in Google developer console under Browser key.

file:///android_asset/www/index.html
file:///android_asset/www/index.html#/map

And i've added below permissions in manifest.xml also

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

But still issue exists. Can someone help me to solve this issue ?

There seems to be a discussion about the same error in the ionicframework site about this.

A cordova plugin was referenced that was said to have worked better than JavaScript API.

For file:// referers, you need to replace the file:/ with __file_url__ .

As the documentation states:

file:// referers need a special representation to be added to the Key restriction.

The file:/ part should be replaced with __file_url__ before being added to the Key restriction. For example, file:///path/to/ should be formatted as __file_url__//path/to/* . After enabling file:// referers, it is recommended you regularly check your usage, to make sure it matches your expectations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM