安卓:启用/禁用自动同步和背景资料 [英] Android: Enable/Disable Auto Sync and Background Data

查看:202
本文介绍了安卓:启用/禁用自动同步和背景资料的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望开发禁用后台数据和自动同步(在Android 1.5的新功能)的应用程序,然后启用GPRS / EDGE连接,反之亦然。

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.

我想出如何通过更改APN设置启用/禁用GPRS / EDGE。 (奇怪的解决方案,但是; Android开发想不出一个用户可能需要禁用GPRS / EDGE)但是,我无法找到一个方法来启用/禁用自动同步和背景数据

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.

我调查了Android code和我的理解,同步操作的意图。所以,我想与putExtra达成的打算,并触发启用/禁用。但;我找不到正确的关键字。或者可能是我完全错了。所以,我需要一些建议。

I investigated the Android code and as I understood, the Sync operation is an intent. 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.

推荐答案

在我的HTC的梦想,有一个复选框以关闭自动同步。我可以查找菜单树状,如果你愿意的话,你可以找到回调函数是在Android源$ C ​​$ C什么。但我pretty的确保自动同步不能完全禁用。取消选中自动同步将prevent同步从一个定时的基础正在执行,但它会发生,每次运行带有同步功能的应用程序,如果任何网络数据连接。

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.

好运气呢。

编辑:

有两种方式来获得你想要的信息。

There are two ways to get the info you desire.

首先,我的事情你可以用code在ndroid-源/封装/应用程序/设置/ src目录/ COM /安卓/设置/ Utils.java创建活动,将列出的意图的所有键然后找到你想要的。

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.

另一种方式是写一个好的邮件的家伙谁做的的toogle设置应用程序(的http://smartphoneandroid.com/2008/12/28/toggle-setting-perfect-app-for-android-phone.html)因为他显然找到了解决你的问题。他的电子邮件地址是写在Android Market上的应用程序表。我不会把它写在这里,但如果你没有获得真正的Andr​​oid手机,我可以把它邮寄给你在yopmail联系地址。

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.

这篇关于安卓:启用/禁用自动同步和背景资料的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆