I want to create android app that while i am in my wifi area it will use the wifi soon as "MyWifi" is not in reach should change and start data connection through 3g/4g...so my question is how to make the application to run 24/7 and drain less as possible battery, also if anyone can givme something about wifi and data connection what are the system calls, or refer me to any tutorials od examples that think that i will find them handy< Thanks
Asked
Active
Viewed 322 times
2
-
Assuming wifi is enabled, Android will use the best connectivity option available, so you don't have to worry about that. But what are you trying to do? What is your app going to do 24/7? – claesv Feb 23 '12 at 12:57
-
i was planing to have non-stop network, so when is not in my home networks range to turn on data and continue on 3g when my home network is in range to turn off data and switch to wifi – Tony Feb 23 '12 at 12:59
-
Again, Android will do that for you. You don't have to worry about it. Just open connections and Android will use whatever connectivity options are available. – claesv Feb 23 '12 at 13:01
1 Answers
2
You will not want to let your app "run" 24/7, because that will cause the device to never go to sleep and therefore drain the battery in a way that is usually not acceptable.
You can easily catch an broadcast of the state change of your wifi connection. For an example you can look here
If you want your app to be running 24/7, is it to react to some events? Because you can usually catch any event with BroadCast-Receivers or Intents. In most scenarios this is the way to go.