[英]Corona SDK: In-app purchases do not return status on Android
My cross-platform (iOS and Android) application includes one in-app purchase. 我的跨平台(iOS和Android)应用程序包括一次应用程序内购买。 The algorithm is as follows: 算法如下:
Performing initialization when start the application: 启动应用程序时执行初始化:
if store.target == "apple" then store.init( "apple", transactionListener) elseif store.target == "google" then store.init( "google", transactionListener ) restoring = true timer.performWithDelay( 1000, restore() ) else print("In-app purchases are not supported on this system/device.") end
When you click «Buy» the purchase is made, but transactionCallback returns no status. 当您单击“购买”时,即完成购买,但transactionCallback不返回任何状态。
store.restore()
does not work at all! 选项store.restore()
根本不起作用! All of the above works fine on iOS!!! 以上所有内容在iOS上都可以正常使用!!!
What is the problem? 问题是什么?
Please make sure that you have added proper settings in build.settings file. 请确保您已在build.settings文件中添加了正确的设置。
settings =
{
android =
{
usesPermissions =
{
"com.android.vending.BILLING",
},
},
}
If your application is in sandbox mode then you should have to test IAP by android product provide by them. 如果您的应用程序处于沙盒模式,则您必须通过它们提供的android产品测试IAP。 Please see below product id's for your different transaction and check with purchased, canceled and item_unavailable conditions. 请为您的不同交易查看以下产品ID,并检查购买,取消和item_unavailable条件。 After successful testing just replace your products with dummy ones. 在成功测试之后,只需用虚拟产品替换您的产品。
-- Product IDs for the "google" Android Marketplace store.
local googleProductList =
{
-- These product IDs are used for testing and is supported by all Android apps.
-- Purchasing these products will not bill your account.
"android.test.purchased", -- Marketplace will always successfully purchase this product ID.
"android.test.canceled", -- Marketplace will always cancel a purchase of this product ID.
"android.test.item_unavailable", -- Marketplace will always indicate this product ID as unavailable.
}
Second thing is that: In the Google Play Marketplace, there is no "restored" state for items. 第二件事是:在Google Play市场中,商品没有“恢复”状态。 All purchased items will be grouped under the "purchased" state. 所有购买的物品都将被归类为“已购买”状态。 When you do a restore, you should clear all purchases saved to file/database — except for consumable purchases — and treat the returned restored purchases as normal purchases. 进行还原时,应清除所有保存到文件/数据库中的购买(消耗品购买除外),并将返回的还原购买视为正常购买。
Please check. 请检查。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.