Google Maps API错误:Play商店上的RefererNotAllowedMapError [英] Google Maps API error: RefererNotAllowedMapError on play store

查看:94
本文介绍了Google Maps API错误:Play商店上的RefererNotAllowedMapError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它在网上有很多答案,但我仍然很笨,无法亲自破解它:(.

It has many answers online but still I am dumb enough to crack it myself :(.

我有一个Ionic混合应用程序(Ionic,Angular和Visual Studio).开发工作即将完成,并且工作正常.我已使用.keystore证书签署了我的应用程序.我还在Google控制台中生成了API密钥,并在HTTP Referrers (Web Site)上设置了限制.

I have an Ionic hybrid app (Ionic, angular and Visual Studio). Development is almost done and working fine. I have signed my app using .keystore certificate. I have also generated an API key in Google Console and gave it restriction on HTTP Referrers (Web Site).

在我的本地(开发环境)上,它停止工作.因此,我添加了http://localhost:4000/index.html#find(甚至是localhost)作为API密钥的引荐来源网址.这样可以解决问题,现在可以正常工作了.

On my local (dev environment), it stopped working. So I added http://localhost:4000/index.html#find (or even localhost) as referrer to API key. This fixed the problem and now it is working fine.

但是我的应用程序无法在android设备上运行.我不确定那里的引荐来源网址应该是什么.作为试用,我使用Visual Studio调试了设备.以下是我跟踪的错误.

However my app is not working in android device. I am not sure what should be the referrer URL there. As a trial, I debugged my device using visual studio. Following is the error that I tracked.

Google Maps API error: RefererNotAllowedMapError https://developers.google.com/maps/documentation/javascript/error-messages#referer-not-allowed-map-error
Your site URL to be authorized: file:///android_asset/www/index.html#find

但是,将file:///android_asset/www/index.html#find添加为引荐来源网址并不能解决问题.对我来说,它们指向原始文件指向我的系统时(在我调试时),这似乎是预料之中的.那么,在我添加应用程序以播放商店后,使所有设备正常工作的价值是什么?

However adding file:///android_asset/www/index.html#find as referrer is not solving the problem. To me it looks expected as they are pointing to raw file to my system (as I am debugging). So, what should be the value of this to make all devices work after I add my app to play store?

它是否必须来自manifest.xml或我的应用程序项目?还是我需要在Google Play Console中的某处提到这一点?有人可以指导我吗?

Do it has to come from manifest.xml or my app project? Or do I need to mention this somewhere in Google Play Console? Could anyone please guide me?

推荐答案

Cloud开发人员控制台目前不支持file:/引荐来源网址.

The file:/ referrers are not supported in Cloud developer console at the moment.

您可以考虑以下两种选择:

You can consider two options:

  1. 使用不受HTTP引荐来源网址限制的其他API密钥
  2. 购买高级套餐,其中客户端ID支持file:/引荐来源.

有一个问题9996 在公开问题跟踪程序中,涉及带有file:///协议的引荐来源网址.我建议为该问题加注星标,以表达您的兴趣并获得进一步的更新.

There is an issue 9996 in the public issue tracker regarding referrers with file:/// protocol. I would suggest starring the issue to express your interest and receive further updates.

更新

好消息,Google已添加对file:/引荐来源网址的支持.您可以在文档中看到以下文本

Good news, Google has added support for file:/ referrers. You can see the following text in the documentation

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

https://developers.google.com /maps/documentation/javascript/get-api-key#key-restrictions

这篇关于Google Maps API错误:Play商店上的RefererNotAllowedMapError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆