• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Where is the best place to implement my geofence method?

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have created a method that builds a geofence based on the marker location. I am trying to determine where the best place to insert it is, so that it is specifically linked to the marker's location. Any thoughts?

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by "where" - in the code? on the map? I'd say it depends on what the app does - does it make sense to create the fence when the marker is created, or should it be created later on as the result of some user interaction?
 
Jared Snyder
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The geofence should be created once a marker is placed, and updated if the marker is moved. The monitoring of that fence will commence upon a user interaction, which is the pressing of a toggle button.

I'm thinking that I might do the monitoring code as a separate class.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So you need to build the fence as soon as the marker is set, and put some listener in place that alerts you if the marker is moved - and update the fence accordingly. That sounds relatively straightforward to me (although I have no idea about the fence APIs).

"Monitoring" sounds like adding a listener of some kind to the fence.
 
Jared Snyder
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've solved this one. I ended up overhauling all of my code related to this. I can't post my code, because it is integrated throughout my MainActivity and a couple other activities, but I will say that I referred to these sites for help:

http://wptrafficanalyzer.in/blog/adding-and-removing-proximity-alert-in-google-map-android-api-v2-using-locationmanager/
https://developer.android.com/training/location/geofencing.html
 
snakes are really good at eating slugs. And you wouldn't think it, but so are tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic