usr*_*ΛΩΝ 6 android accountmanager
我正在尝试使用Android AccountManager.
我有一个帐户身份验证服务,显示用于输入用户名/密码的UI.
我转到设置/帐户/添加帐户,选择我的新帐户类型,然后我看到了UI.
当我单击确定时,我收到以下错误
04-24 14:48:29.334: E/AndroidRuntime(386): java.lang.SecurityException:
caller uid 10035 is different than the authenticator's uid
Run Code Online (Sandbox Code Playgroud)
MyAccountAuthenticationService的唯一方法:
@Override
public IBinder onBind(Intent intent) {
return new MyAccountAuthenticator(this).getIBinder();
}
Run Code Online (Sandbox Code Playgroud)
MyAccountAuthenticator:
@Override
public Bundle addAccount(AccountAuthenticatorResponse response,
String accountType, String authTokenType, String[] requiredFeatures,
Bundle options) throws NetworkErrorException {
final Intent intent = new Intent(context, MyAccountCreatorActivity.class);
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
final Bundle bundle = new Bundle();
bundle.putParcelable(AccountManager.KEY_INTENT, intent);
return bundle;
}
Run Code Online (Sandbox Code Playgroud)
片段MyAccountCreatorActivity的onClick
AccountManager accManager = AccountManager.get(this);
Account newAccount = new Account(email, MyAccountAuthenticator.ACCOUNT_TYPE);
accManager.setPassword(newAccount, password);
Run Code Online (Sandbox Code Playgroud)
抛出异常setPassword.我已经要求所有的会计权限.我不确定是什么原因引起的.如果您需要更多代码/信息,请询问.
谢谢.
dro*_*kar 17
看起来很明显,但如果未在AndroidManifest.xml中定义验证器服务,您也会看到此错误.例如:
<service android:name="your.AuthService">
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator" />
</intent-filter>
<meta-data android:name="android.accounts.AccountAuthenticator"
android:resource="@xml/authenticator" />
</service>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11253 次 |
| 最近记录: |