How to store cache in Google map programmatically. After cache it will be working with offline.
please suggest source or any link.
How to store cache in Google map programmatically. After cache it will be working with offline.
please suggest source or any link.
You have to call the Google maps snapshot method to save the current visible map's snapshot and save this in the sdcard. futher more you can view all the stored images later.
private void button_listener() {
Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SnapshotReadyCallback callback = new SnapshotReadyCallback() {
Bitmap bitmap;
@Override
public void onSnapshotReady(Bitmap snapshot) {
// TODO Auto-generated method stub
bitmap = snapshot;
try {
FileOutputStream out = new FileOutputStream("/mnt/sdcard/Download/TeleSensors.png");
bitmap.compress(Bitmap.CompressFormat.PNG, 90, out);
} catch (Exception e) {
e.printStackTrace();
}
}
};
map.snapshot(callback);
}
});
}
make sure you have WRITE_EXTERNAL_STORAGE permission in your manifest file