I am working on GoogleMaps and and i placed the markers on the google map. The markers info i am getting by calling an api.
Now my problem is if a user is not having the Internet connectivity or if it is down i don't want that app should get crashed instead it should show the user last session markers placed on the google map.
I have read and tried some approaches like it can be done using onPause() or onStart() methods. But i am not getting it:
The source code looks something like this.
public class MapActivity extends Activity{
// onCreate
// making an asynchronous call and storing the latitude and longitude of multiple marker in varibale place
doInBAckground(){
place = apicall.getPlaces();
}
onPostExecute(){
plotmarkers(place);
}
private void plotMarkers(List<Place> markers) {
if (markers.size() > 0) {
for (Place myMarker : markers) {
MarkerOptions markerOption = new MarkerOptions().position(new LatLng(myMarker.getLatitude(), myMarker.getLongitude()));
markerOption.icon(BitmapDescriptorFactory.fromResource(markerImage));
Marker currentMarker = mMap.addMarker(markerOption);
mMarkersHashMap.put(currentMarker, myMarker);
}
}
}
}
Now what i want is I should be able to show the user previous saved instance. I am not getting this to work.. I have seen OLA cabs app able to do like this.
Please just let me know how to approach it... Thanx in advance.. If needed any more snippets just let me know