Simulate Location Changes

In order to simulate changes to the devices location you need to execute shell commands in the Genymotion Shell. This ruby script will help simulate those changes (Geofencing Simulator). I also had to add the Genymotion shell to my path

export PATH=$PATH:/Applications/GenymotionShell.app/Contents/MacOS

To run the ruby script you need to execute it in a bash shell like

$ ruby gpx_trip.rb /path/to/gpx_trip.gpx

The final piece to this is generating a .gpx file that maps out a route. To do this you just create a route from point A to point B . Since the two geofences in the sample are the Googleplex and the Yerba Buena Gardens, I have created a route that goes back and forth between these two locations (Geofencing route) . Then you can take this url and paste it into this GPSVisualizer tool(Convert a GPS file to plain text or GPX) and click on Convert. This will generate the .gpx file that you see on the next page (GPX output) . Copy those contents and paste it into a new file that you create called gpx_trip.gpx . As soon as you execute the ruby script you should now see the blue dot on the Google Maps app start moving in the map. Subsequently when you enter and exit the geofences then a notification will appear in the notification drawer indicating entering or exiting a geofence. This all is a bit verbose but I wanted to make sure I didn’t miss anything. Hopefully this will all be a bit easier in the future.