java - Illegal character in query to maps.googleapis -
i'm developing android application use google maps. locate user , want show pois in vicinity through query maps.googleapis. in java code have string use httprequest obtain information. string is:
"https://maps.googleapis.com/maps/api/place/nearbysearch/" + "json?location="+lat+","+lng+ "&radius=1000&sensor=true" + "&types=food|bar|store|museum|art_gallery"+ "&key=mykey";
where lat , lng 2 variables contains coordinates of position of user , mykey api key. when launch application in log section obtain "illegal character in query @ index 125" , conseguently in maps obtain no pois. if delete " , + characters in string , use link in browser obtain list of pois. how can obtain list in application?? don't understand error in string.. thx all
according this link '|' character should replace '%7c'
you can use this
string url=""https://maps.googleapis.com/maps/api/place/nearbysearch/" + "json?location="+lat+","+lng+ "&radius=1000&sensor=true" + "&types=food|bar|store|museum|art_gallery"+ "&key=mykey";"; url.replaceall(" ","%20");
Comments
Post a Comment