"Sync is Off" 在 运行 之后使用 ContentResolver.requestSync() 函数显示 Sync Adapter On Demand
"Sync is Off" showing after running the Sync Adapter On Demand using ContentResolver.requestSync() function
我正在尝试实施 Contact Sync Adapter。当我从相应帐户下给出的同步选项进行同步操作时,它工作正常。但是当我尝试调用 requestSync()
第一次 单击按钮时,SyncAdapter 实现的 onPerformSync()
函数调用并成功执行但仍然显示 Sync 是在同步设置中相应的帐户下关闭。
我的 运行 按需同步适配器代码是:
Bundle settingsBundle = new Bundle();
settingsBundle.putBoolean(
ContentResolver.SYNC_EXTRAS_MANUAL, true);
settingsBundle.putBoolean(
ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
/*
* Request the sync for the default account, authority, and
* manual sync settings
*/
ContentResolver.requestSync(mAccount, AUTHORITY, settingsBundle);
所以请指导我,有什么方法可以在 运行 按需同步适配器之后打开同步设置。
我需要在调用 requestSync(----)
之前设置 属性 以实现我的目标:
ContentResolver.setSyncAutomatically(mAccount, getString(R.string.content_provider_authority), true);
我正在尝试实施 Contact Sync Adapter。当我从相应帐户下给出的同步选项进行同步操作时,它工作正常。但是当我尝试调用 requestSync()
第一次 单击按钮时,SyncAdapter 实现的 onPerformSync()
函数调用并成功执行但仍然显示 Sync 是在同步设置中相应的帐户下关闭。
我的 运行 按需同步适配器代码是:
Bundle settingsBundle = new Bundle();
settingsBundle.putBoolean(
ContentResolver.SYNC_EXTRAS_MANUAL, true);
settingsBundle.putBoolean(
ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
/*
* Request the sync for the default account, authority, and
* manual sync settings
*/
ContentResolver.requestSync(mAccount, AUTHORITY, settingsBundle);
所以请指导我,有什么方法可以在 运行 按需同步适配器之后打开同步设置。
我需要在调用 requestSync(----)
之前设置 属性 以实现我的目标:
ContentResolver.setSyncAutomatically(mAccount, getString(R.string.content_provider_authority), true);