I am not new to Android but what I want to do I haven't found the answer to.
I know we can make a app work if it is within a certain location (next to a cell tower, active wifi etc) but what I want to do is the reverse.
For example if I person walks into a school zone I want the app to close the http request, or if the user walks into a Police station I want the app to crash! So like if the user is within a certain region the app will work but if they leave that region the app fore close.
Is that possible and if so how do I achieve this goal?
I made an app with similar functionality. While the user was on campus their phone would not ring but vibrate instead when they had an incoming call. To do this my app ran as a service; it would start and run in the background when their phone was turned on. The app would constantly monitor the users location by getting the users GPS location every 10 minutes (however this drains the battery rather quickly).
After getting the users location I had to determine if they were on campus. I picked a GPS point in the center of campus and compared this with the users location. To do this I used the Location.distanceBetween() method to determine if the user was within a half mile radius of the center of campus. If the user was on campus I would change the phone setting to vibrate and when they left campus I would change it back to their previous setting.
As NickL mentioned you will need to code the static locations or get them from a server. Also, having your region be a circle would be much easier than other shapes.