我使用 ButtonClicker 示例作为基本框架将我们的游戏连接到亚马逊商店。我正在尝试实现店面,因此在onItemDataResponse
回调中构建可购买项目的目录。但这onGetUserIdResponse
永远不会被调用。但是 sdk 测试器正在记录成功的项目数据响应广播和用户 ID 响应广播并记录 amazon.sdktester.json 的内容。请注意onSdkAvailable
正在调用....有其他人经历过吗?如果是这样,你是如何绕过它的?任何帮助或建议都会很棒。谢谢克里斯
2 回答
I just had the same problem you described. ( I was getting no callback in from the purchasing manager )
In my manifest i had:
<receiver android:name = "com.amazon.inapp.purchasing.ResponseReceiver"
android:exported="false" >
<intent-filter>
<action android:name = "com.amazon.inapp.purchasing.NOTIFY" android:permission = "com.amazon.inapp.purchasing.Permission.NOTIFY" />
</intent-filter>
</receiver>
Removing the android:exported="false" attribute resolved the problem for me. Originally I had added the android:exported="false" attribute because it removes the warning "exported receiver requires no permission"
Now my manifest looks like this and in app purchasing can be properly tested using the sdk tester:
<receiver android:name = "com.amazon.inapp.purchasing.ResponseReceiver" >
<intent-filter>
<action android:name = "com.amazon.inapp.purchasing.NOTIFY" android:permission = "com.amazon.inapp.purchasing.Permission.NOTIFY" />
</intent-filter>
</receiver>
首先,如果您正在测试,请确保已安装 SDK Tester 应用程序并且您已将amazon.sdktester.json
文件上传到/mnt/sdcard/
您的设备或模拟器上(如此处所述)。
onSdkAvailable
调用回调不需要任何 IPC,因此它并不表示您正在与客户端或测试程序应用程序进行通信。
另外,请确保您已在清单中声明了接收方。来自亚马逊文档:
<receiver android:name="com.amazon.inapp.purchasing.ResponseReceiver" >
<intent-filter>
<action android:name="com.amazon.inapp.purchasing.NOTIFY"
android:permission="com.amazon.inapp.purchasing.Permission.NOTIFY" />
</intent-filter>
</receiver>
(附带说明,标签android:permission
上的属性<action>
没有做任何事情。但是,如果您将其移动到<receiver>
它所属的标签,您将再次不会收到广播 - 至少来自 SDK Tester 应用程序,并且可能来自IAP 客户端也是如此。您可以按照文档的建议保留它,或者直接删除该android:permission
属性;请参阅此线程。)