Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google maps containsLocation on android

I'm writing an app that needs to determine whether a user falls within one of several defined zones (based on gps location).

The Google maps javascript API has an easy to use function containsLocation(). However I want to be able to do this from an app on android, not a web-based service. Does anyone know if such a call exists in the android version of maps? Any pointers will be helpful!

like image 565
aguywithsocks Avatar asked Dec 18 '14 22:12

aguywithsocks


2 Answers

A bit late, but here's the answer: com.google.maps.android.PolyUtil.containsLocation() from Google Maps Android API utility library.

like image 97
Uli Avatar answered Sep 20 '22 01:09

Uli


You can use the Geofencing feature for this purpose. The API's for that are a part of Google Play Services library and hence you can start using it by importing it into your app project.

It even gives the notification if a particular user has entered or exited a specific geofencing location in order for a developer to monitor the number of mobile devices entered in the zone he defined. The implementation is pretty simple, I am pasting some links that may guide you further.

This is Google's official documentation about Geofencing: http://developer.android.com/training/location/geofencing.html

This link actually implements an app for geofencing.

And this is another link if you want to use a third party plugin in order to get geofencing in your app.

Hope this would help!!!

like image 22
AniV Avatar answered Sep 20 '22 01:09

AniV