【发布时间】:2015-09-04 06:32:40
【问题描述】:
我们正在使用谷歌距离矩阵 API 来显示用户当前位置和目的地点之间的旅行距离,该活动也显示谷歌地图。我们正在使用以下 url 以及使用 app 包和 debug.keystore 的 sha1 生成的 Android 密钥。
// 路由的起源 String str_origin = "origin=" + origin.latitude + "," + origin.longitude;
// Destination of route
String str_dest = "destination=" + dest.latitude + "," + dest.longitude;
// Building the parameters to the web service
String parameters = str_origin + "&" + str_dest + "&" + sensor;
// String parameters = str_origin + "&" + str_dest + "&";
// Output format
String output = "json";
String url = "https://maps.googleapis.com/maps/api/distancematrix/" + output +"?"
+ parameters + "&mode=walking&key=" +"Android_Key";
但上面的网址给出了以下响应,
{"destination_addresses" : [], "error_message" : "This IP, site or mobile application is not authorized to use this API key. Request received from IP address *.*.*.*, with empty referer", "origin_addresses" : [], "rows" : [], "status" : "REQUEST_DENIED"}
这里有什么问题?它适用于未映射到应用程序包名称和 sha1 的 android 键。
【问题讨论】:
标签: android google-maps google-maps-android-api-2