Android Google Maps OnMapReadyCallback() not happening on Device (works on simulator) -
i created android mobile app uses google maps api generate simple map , put marker on it.
everything works great in android simulator, when use android device, mapview.getmapasync not trigger onmapreadycallback().
another thing noted getting these messages, not sure if related problem. tried update in sdk these messages don't go away:
04-07 20:36:30.990 10487-10487/it.bitrack.fabio.bitrack w/googleplayservicesutil: google play services out of date. requires 10298000 found 9879448 04-07 20:36:30.992 10487-10487/it.bitrack.fabio.bitrack w/googleplayservicesutil: google play services out of date. requires 10298000 found 9879448 04-07 20:36:30.993 10487-10487/it.bitrack.fabio.bitrack w/googleplayservicesutil: google play services out of date. requires 10298000 found 9879448 04-07 20:36:30.994 10487-10487/it.bitrack.fabio.bitrack w/googleplayservicesutil: google play services out of date. requires 10298000 found 9879448
would know why? code below...
code:
mapview.getmapasync(new onmapreadycallback() { @override public void onmapready(googlemap googlemap) { map = googlemap; map.addmarker(new markeroptions() .position(new latlng(asset.latitude, asset.longitude)) .title(asset.networkassetcode)); map.setmaptype(googlemap.map_type_hybrid); map.movecamera(cameraupdatefactory.newlatlngzoom(new latlng(asset.latitude, asset.longitude), 17)); lastseentextview.settext("last seen: " + asset.datetime); try { r.getlocationfromcoordinates(asset.latitude, asset.longitude, new callback() { @override public void onfailure(call call, ioexception e) { e.printstacktrace(); } @override public void onresponse(call call, response response) throws ioexception { try (final responsebody responsebody = response.body()) { if (!response.issuccessful()) throw new ioexception("unexpected code " + response); headers responseheaders = response.headers(); (int = 0, size = responseheaders.size(); < size; i++) { system.out.println(responseheaders.name(i) + ": " + responseheaders.value(i)); } final string result = responsebody.string(); log.i("bitrack", "google reverse geolocation\n" + result); try { getactivity().runonuithread(new runnable() { @override public void run() { json j = new json(); updatemapview(j.getaddressfromgeolocationcoordinates(result)); } }); } catch (exception e) { e.printstacktrace(); } } } }); } catch (exception e) { e.printstacktrace(); } } });
i fix issue adding piece of code found in question here:
googleplayservicesutil: google play services out of date. requires 5089000 found 5077534
private boolean checkplayservices() { googleapiavailability googleapi = googleapiavailability.getinstance(); int result = googleapi.isgoogleplayservicesavailable(getcontext()); if(result != connectionresult.success) { if(googleapi.isuserresolvableerror(result)) { googleapi.geterrordialog(getactivity(), result, play_services_resolution_request).show(); } return false; } return true; }
Comments
Post a Comment