c# - Requests POI from a location using Xamarin (Android) -
im trying create android app xamarin.i want user able input address/location , receive poi (points of interest) near (within radius).
i know google places api can this, xamarin have built in capability this? can somehow interface google places api?
or there don't know about? help!
use httpwebrequest class create request google api, code snippet:
private void button1_click(object sender, eventargs e) { httpwebrequest webrequest = webrequest.create(@"https://maps.googleapis.com/maps/api/place/search/json?location=-33.8670522,151.1957362&radius=7500&types=library&sensor=false&key=aizasyd3jfemzk1swfrfdgmfxn_zrgrsje7s8vg") httpwebrequest; webrequest.timeout = 20000; webrequest.method = "get"; webrequest.begingetresponse(new asynccallback(requestcompleted), webrequest); } private void requestcompleted(iasyncresult result) { var request = (httpwebrequest)result.asyncstate; var response = (httpwebresponse)request.endgetresponse(result); using (var stream = response.getresponsestream()) { var r = new streamreader(stream); var resp = r.readtoend(); } }
copy on here... pretty straightforward , simple...
Comments
Post a Comment