Suri P
Suri P

Reputation: 89

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 ?

Upvotes: 1

Views: 881

Answers (2)

Dylan w
Dylan w

Reputation: 2896

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.

Upvotes: 1

adjuremods
adjuremods

Reputation: 2998

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.

Upvotes: 1

Related Questions