Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to restrict maps to only one country using google maps api for android

I am totally new to google's maps api for android and I was wondering if it is possible to restrict the area the map is showing to one country only. I mean my target users are in my own country only and it is not useful nor logical to show them the whole world when the application logic is going to be only on this country.

Any ideas?

ps: if it is not possible in google's api,is there a way to do this with another api form another source which provides a mapping service?

like image 278
roostaamir Avatar asked Apr 13 '16 13:04

roostaamir


1 Answers

If you are still interested, now it's possible to restrict the user's panning to a given area using the setLatLngBoundsForCameraTarget method.

You will need to update the dependencies for your Play Services:

dependencies {
    compile 'com.google.android.gms:play-services:9.6.1'
}
like image 88
antonio Avatar answered Nov 02 '22 05:11

antonio