我正在开发一个用于新固件的欢迎应用。 此应用程序将在出厂重置后立即运行。 我想知道是否有办法创建一个谷歌帐户(如果新用户还没有一个)联系人和callendar同步。 我有SimpleSyncAdapter示例,我很难弄清楚如何使用自定义活动表单,这将是教程/欢迎应用程序的一个步骤。在google示例中,AuthenticatorActivity启动一个AuthenticationService,用于实例化Authentication类。
Authentication类具有以下方法:
public Bundle addAccount(AccountAuthenticatorResponse response, String accountType,
String authTokenType, String[] requiredFeatures, Bundle options) {
final Intent intent = new Intent(mContext, AuthenticatorActivity.class);
intent.putExtra(AuthenticatorActivity.PARAM_AUTHTOKEN_TYPE, authTokenType);
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
final Bundle bundle = new Bundle();
bundle.putParcelable(AccountManager.KEY_INTENT, intent);
return bundle;
}
但是我无法实例化在AccountActivity中扩展AbstractAccountAuthenticator的Authentication类。另外,我不确定这是否会对我有所帮助。我不清楚这种方法的作用。
任何人都能解释一下吗?
谢谢大家!
答案 0 :(得分:1)