San*_*ndy 5 android google-maps google-maps-api-3 ionic-framework
它在网上有很多答案,但我仍然很愚蠢,无法自己破解:(。
我有一个Ionic混合应用程序(Ionic,Angular和Visual Studio)。开发工作即将完成,并且工作正常。我已经使用.keystore证书签署了我的应用程序。我还在Google控制台中生成了一个API密钥,并对其设置了限制HTTP Referrers (Web Site)
。
在我的本地(开发环境)上,它停止工作。因此,我添加了http://localhost:4000/index.html#find
(甚至localhost
)作为API密钥的引荐来源。这解决了问题,现在可以正常工作。
但是我的应用程序无法在android设备上运行。我不确定那里的引荐来源网址应该是什么。作为试用,我使用Visual Studio调试了设备。以下是我跟踪的错误。
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
Run Code Online (Sandbox Code Playgroud)
但是,添加file:///android_asset/www/index.html#find
为引荐来源网址并不能解决问题。对我来说,它们指向原始文件指向我的系统时(在我调试时),这似乎是预期的。那么,在我添加应用程序以播放商店后使所有设备正常工作的价值是什么?
它必须来自manifest.xml
我的应用程序项目吗?还是我需要在某处提及Google Play Console
?有人可以指导我吗?
目前,Cloud开发者控制台不支持file:/ Referrers。
您可以考虑以下两种选择:
在公共问题跟踪器中,有关带有file:///协议的引荐来源的问题9996。我建议为该问题加注星标,以表达您的兴趣并获得进一步的更新。
更新
好消息,Google已添加对file:/引荐来源网址的支持。您可以在文档中看到以下文本
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
归档时间: |
|
查看次数: |
753 次 |
最近记录: |