-1

Would it be possible to make an Android application that works based on location, for example when you get to work the app might turn off WiFi or Bluetooth or change any other system settings in order to save battery or something?

The app would require the user to enter in locations where they want the app to begin working, like their address, and when the phone sees that they have arrived at this location it will start working. I want to do this but I don't know where to start.

I already have some android app development experience.

Siddharth
  • 9,349
  • 16
  • 86
  • 148

3 Answers3

1

Yes absolutely this is possible. I have worked on approx three application with same concept.

You need to create a center point and define a radius for the same. Then you need to calculate the distance of you current location with that particular center point and if your distance is less than or equal to radius, trigger to switch on the services you want. In android you can use

LocationManager class

For collecting the data. If you want some more help I can provide the same too.

  • thats awesome exactly what i wanted would you be willing to help me along im only 15 and this is my first serious try at an app that isnt hello world or a calcualtor lol. – Tinashe Shoko May 31 '13 at 08:07
  • check this URL http://developer.android.com/reference/android/location/Location.html#distanceBetween%28double,%20double,%20double,%20double,%20float%5B%5D%29 the distance between function is the one you are searching for. – Deepak Srivastava May 31 '13 at 08:12
0

I've played around with a concept like this on the Windows Phone for a while, and I think this would work for Android too.

Basically, you'd use the GPS of the device to detect your location, and then compare this to the locations saved by the user. If the location comes within range of a saved setting, perform an action.

GPS usage however drains battery, so you'd have to experiment a bit with making this an efficient method.

0

Have you tried GeoFencing, its really cool. It lets you define a center point, and a radius. Once the user enters this radius you get callback or a pendingIntent. You can do what you want in your callback.

You can get addresses of your customers and build geofence around their locations.

Edit :

If you choose to not use GeoFenceing (for what ever reason), note that LocationManager is highly buggy and unstable on most mobile phones (Samsung).

Instead use LocationClient, which takes care of all the crap LocationManager leaves with us to deal with and provides location faster, lesser battery and customized accuracy.

Edit :

If anyone tries to convince you otherwise, check this out. A video from google developers and their talk about why LocationManager sucks, and why they knew and helped us figure out the value Sensors add to the entire solution.

Edit : Design of your solution You need 2 geofences 1) Outer, you can hard code this to a imaginary 500 m from office. From then on you can start looking for wifizones 2) Once a wifizone is found, save the gps and the distance from his address point. That is your inner radius.

1 Geofence is defined by your install, 2nd geofence is defined by your runtime.

2nd Geofence and be used henceforth to disable GPS (only incase you decide to use LocationManager). If not you wont need this, LocationClient will do what it does best.

Siddharth
  • 9,349
  • 16
  • 86
  • 148
  • that sounds awesome ile check it out and get back to you i think its exactly what i need – Tinashe Shoko May 31 '13 at 08:06
  • i looked at geofencing you make a good point but with geofencing can i make it so the suer defines the perimeter in which it is affective like for example the user would type in their work adress and when they enter the app would start working? – Tinashe Shoko May 31 '13 at 08:18