views:

10509

answers:

2

I want to develop an application that disable the Background Data (new feature in Android 1.5) and Auto Sync and then enable GPRS/EDGE connection and vice versa.

I figured out how to enable/disable GPRS/EDGE by changing the APN settings. (weird solution. However; Android developers couldn't think a user may want to disable GPRS/EDGE) But, I couldn't find a way to enable/disable Auto Sync and Background data.

I investigated the Android code and as I understood, the Sync operation is an intend. So, I wanted to reach with putExtra to the intend and trigger the enabling/disabling. But; I couldn't find the correct keyword. Or may be I am totally wrong. SO, I need some advice.

If you could tell me how can I do or where should I look, I would be very happy. Thank you.

+2  A: 

In my HTC dreams, there is a checkbox to disable the auto sync. I can look for the menu arborescence if you wish so you can find what the callback function is in the android source code. But I am pretty sure auto synch cannot completely be disable. Unchecking auto sync will prevent sync from being performed on a timed basis, but it will occur everytime you run an app with synch capabilities if any network data connection is available.

Good luck anyway.

EDIT :

There are two ways to get the info you desire.

First, I thing you can use the code in ndroid-sources/packages/apps/Settings/src/com/android/settings/Utils.java to create an activity that will list all the keys of the intent then find the one you want.

The other way is to write a nice mail to guy who made the Toogle Setting app (http://smartphoneandroid.com/2008/12/28/toggle-setting-perfect-app-for-android-phone.html) since he obviously found a solution to your problem. His email adress is written in the app sheet on the android market. I won't write it here, but if you do not have access to real android phone, I can mail it to you on a yopmail adress.

e-satis
If you can find the callback function, I will be very happy. I dig for this information. However; I couldn't find anything. On the other hand, I know that I can not prevent the third party applications to use GPRS/EDGE. But, my main aim is to disable the sync with Google server only. Because; As I observed if auto sync is on, Google sync uses most of my data plan.
Omer
+1  A: 

Background data is a secure setting, so cannot be changed by user applications. But bear in mind, it's just a setting - it's not enforced. Apps are meant to read it and respect it but I bet some don't.

If I can find out to disable auto sync only, Background Data may not be a problem.
Omer