最佳答案
我认为(未经测试)已在ContentResolver中定义了更好的解决方案.
原文链接:https://www.f2er.com/android/430344.htmlContentResolver.requestSync(account,authority,extras);
所以可以做以下事情:
AccountManager am = AccountManager.get(context);
Account account = null;
am.getAccountsByType(mytype);
for(Account a : accounts) {
if (am.getUserData(account,key)) {
account = a;
break;
}
}
Bundle extras = new Bundle();
extras.putString(EXTRA_mystuff,myvalue);
ContentResolver.requestSync(account,extras)