I’m developing an app that use Mobile Data connection (always GPRS) to upload in a loop each 5 minutes 300 kb of data. Between two upload i see that the data connection remains up (gprs logo on status bar) even if there aren’t data transferring….
In this time (between two upload) the battery is used by the Mobile Data connection?
Do you think that i should use this method to disable and enable connection between uploads to save the batterylife or is not helpfull?
If is it so…how can i use that code in my Service Class such as a function, without create a new class? THanx from a noob!
EDIT
The app is for my personal use and the app have the entire control of phone (the phone is alone and it doesn’t interact with the user). So i can sto all data connection…but i can’t use that code as i want (as a function!) Help me!
EDIT 2
Anyway i’m able to enable and disable “airplane mode”, but the reconnection require minim 13-14 seconds. May be this help to save battery in the “dead time”?
You are using whatever the user’s chosen data connection is. You can elect to skip doing the work on WiFi if you want, though I am not quite sure why.
The GSM or CDMA radio is always consuming battery. It consumes more during active data transfer, but it is always powered on (except when the device is in airplane mode).
Only if the only person who will ever run the application is you, you are running an Android 2.2 device (or older), and you don’t mind messing up your phone.
The code you link to is pathetic — it might break on some devices and might break in the future, since it is bypassing the SDK. Moreover, if it is not your phone, I am not quite certain why you think you have the right to foul up other people’s devices. And, to top it off, you can no longer hold the permission necessary to use that hack, as of Android 2.3.