jue*_*ell 3 android android-syncadapter
当用户在"帐户和同步"中选择"添加帐户"或想要使用该应用程序但尚未登录时,我正在尝试让我的应用程序显示我的登录活动.我已经非常密切地关注示例SampleSyncAdapter,但无法使其工作并收到以下异常:
No Activity found to handle Intent { act=android.accounts.AccountAuthenticator }
我的身份验证服务包含:
public IBinder onBind(Intent intent) {
IBinder ret = null;
if (intent.getAction().equals(android.accounts.AccountManager.ACTION_AUTHENTICATOR_INTENT)){
ret = getAuthenticator().getIBinder();
}
return ret;
}
Run Code Online (Sandbox Code Playgroud)
我的AndroidManifest.xml:
<service android:name=".auth.MyAuthService"
android:exported="true"
android:process=":auth">
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator" />
</intent-filter>
<meta-data android:name="android.accounts.AccountAuthenticator"
android:resource="@xml/authenticator"
/>
Run Code Online (Sandbox Code Playgroud)
我的主要活动:
startActivity(new Intent(android.accounts.AccountManager.ACTION_AUTHENTICATOR_INTENT));
Run Code Online (Sandbox Code Playgroud)
我试过这两个:
Intent svc = new Intent(this, CreazaAuthService.class);
startService(svc);
Run Code Online (Sandbox Code Playgroud)
和:
bindService(new Intent(android.accounts.AccountManager.ACTION_AUTHENTICATOR_INTENT), null, BIND_AUTO_CREATE);
Run Code Online (Sandbox Code Playgroud)
在startActivity()通话之前,它仍然找不到该意图的活动.如果我尝试通过帐户添加帐户并同步我的应用程序崩溃ActivityNotFoundException.
我究竟做错了什么?
编辑
我已经检查了c99的last.fm应用程序,该应用程序定义了一个自定义操作并使用基于该操作的意图而不是android.accounts.AccountManager.ACTION_AUTHENTICATOR_INTENT.这是一个更好的方法吗?有没有办法让它与Accounts&Sync一起使用?
| 归档时间: |
|
| 查看次数: |
10342 次 |
| 最近记录: |