我正在尝试实现Google IO中讨论的内容提供商同步适配器模式- 幻灯片26.我的内容提供商正在工作,当我从Dev Tools Sync Tester应用程序触发它时,我的同步工作,但是当我调用ContentResolver时.来自我的ContentProvider的requestSync(帐户,权限,捆绑),我的同步永远不会被触发.
ContentResolver.requestSync(
account,
AUTHORITY,
new Bundle());
Run Code Online (Sandbox Code Playgroud)
编辑 - 添加的清单片段我的清单xml包含:
<service
android:name=".sync.SyncService"
android:exported="true">
<intent-filter>
<action
android:name="android.content.SyncAdapter" />
</intent-filter>
<meta-data android:name="android.content.SyncAdapter"
android:resource="@xml/syncadapter" />
</service>
Run Code Online (Sandbox Code Playgroud)
- 编辑
与我的同步服务关联的syncadapter.xml包含:
<?xml version="1.0" encoding="utf-8"?>
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="AUTHORITY"
android:accountType="myaccounttype"
android:supportsUploading="true"
/>
Run Code Online (Sandbox Code Playgroud)
不确定其他代码会有用.传递给requestSync的帐户是"myaccounttype",传递给调用的AUTHORITY与我的syc适配器xml匹配.
ContentResolver.requestSync是否是请求同步的正确方法?看起来同步测试工具直接绑定到服务并调用启动同步,但这似乎违背了与同步架构集成的目的.
如果这是请求同步的正确方法,那么同步测试器为什么会工作,而不是我对ContentResolver.requestSync的调用?我需要在捆绑中传递一些东西吗?
我正在运行2.1和2.2的设备上的模拟器中进行测试.
我正在尝试Cognito使用他们的Go 实现基于身份验证SDK.我已经能够使基本username/password身份验证工作,但当我添加2因素身份验证时,SMS我遇到了困难.
重现步骤 :
问题,我收到了error:
CodeMismatchException: Invalid code or auth state for the user.
status code: 400, request id: 1513894e-8efa-11e8-a8f8-97e5e083c03b
Run Code Online (Sandbox Code Playgroud)
SMS验证码当然是正确的,因此它似乎必须与auth状态有关.
对Cognito的调用如下所示:
c.cip.SignUp(&cognitoidentityprovider.SignUpInput{
ClientId: aws.String(c.clientID),
Username: aws.String(username),
Password: aws.String(password),
UserAttributes: []*cognitoidentityprovider.AttributeType{
{
Name: aws.String("email"),
Value: aws.String(email),
},
{
Name: aws.String("name"),
Value: aws.String(fullName),
},
},
})
c.cip.ConfirmSignUp(&cognitoidentityprovider.ConfirmSignUpInput{
ClientId: aws.String(c.clientID),
Username: aws.String(username),
ConfirmationCode: aws.String(code),
})
//Add the phone number
c.cip.AdminUpdateUserAttributes(&cognitoidentityprovider.AdminUpdateUserAttributesInput{
UserPoolId: aws.String(c.userPoolID),
Username: aws.String(username),
UserAttributes: …Run Code Online (Sandbox Code Playgroud) 我意识到有几个类似的问题,但没有一个接受的答案对我有用.作为oauth流程的一部分,我想要一个浏览器重定向来启动我的活动.正如我到处看到的那样,我已经设置了一个意图过滤器,据说可以做到:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.codesta.test"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".BrowsableActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="oauth.android.mydomain.com" />
</intent-filter>
</activity>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
但是,当我打开浏览器并输入http://oauth.android.mydomain.com时,我得到"网页不可用"错误页面.我也尝试定义我自己的方案(我读过的通常不推荐),但这也不起作用.
我的目标是api级别7,并且已经在运行2.1和2.2的模拟设备上测试了代码而没有成功.任何帮助将不胜感激!