Reputation: 144
The new Location API in Google allows for creating and monitoring a Geofence that's a circular region with the Geofence.Builder
class. This class only has methods defined for creating a geofence with a circular shape. I was wondering if it was possible to extend the Geofence.Builder
class and create a custom shape. What I wanted to do was have a triangular shape defined instead of a circular one.
If that's not possible does the Geofence class provide for a way to monitor only a certain segment of the circle?
Update: What I want to do is extend a triangle from the users position with one of the vertices being the users location. I want the height of the triangle to be 50 meters and the base of the triangle to be 10 meters. What I want to do afterwards is to detect whenever another user enters this triangle extended from the current users position.
Upvotes: 5
Views: 2453
Reputation: 22232
You may want to forget about using Geofence for this kind of functionality. All users would need geofences from all other users. Just send users positions to server and notify other when someone enters their triangle.
Upvotes: 0
Reputation: 8641
Good question. Alas, you probably won't be pleased with the answer.
Location Services doesn't support non-circular geofences, nor can you monitor only a segment of the circle. Since Geofence.Builder doesn't have a method for creating a non-circular Geofence, there's no way to provide your own extension.
If you post a description of your use case, perhaps someone can figure out an answer.
Upvotes: 2