Symptom
When you call the Google MAP API with a URL similar to the one below:
http://maps.google.com/maps/api/geocode/xml?address=hongkong&sensor=false
It returns the following error:
<GeocodeResponse> <status>REQUEST_DENIED</status> <error_message> You must use an API key to authenticate each request to Google Maps Platform APIs. For additional information, please refer to http://g.co/dev/maps-no-account </error_message> </GeocodeResponse> |
Cause
Google service has now changed the interface. It requires a Google MAP API KEY now and need to call Google MAP API via the https port.
Resolution
PowerServer SalesMobile demo has encountered this issue before, and the resolution is as follows:
Modify the of_gm_getgeocodebyaddrstr function code in appeon_mobileframe.pbl\emf_n_googleservice in the SalesMobile application of PowerServer demo as shown below:
…… ls_request = "http://maps.google.com/maps/api/geocode/xml?address=" + as_queryaddress+ "&sensor=false"
if appeongetclienttype() = "MOBILE" then li_re = ln_inet.of_postURL( ls_request, ls_param, 80 ,as_response) else li_re = ln_inet.of_getURL( ls_request, as_response) end if …… |
Modify the above as follows:
…… ls_request = "https://maps.google.com/maps/api/geocode/xml?address=" + as_queryaddress+ "&sensor=false&key=AIzaSyCDzLcvRhiDMTeWBSBBDmYI1mPhSPaQ9VI"
if appeongetclienttype() = "MOBILE" then li_re = ln_inet.of_postURL( ls_request, ls_param,443,as_response) else li_re = ln_inet.of_getURL( ls_request, as_response) end if …… |