gpt4 book ai didi

android - IabHelper 类不起作用?

转载 作者:IT老高 更新时间:2023-10-28 23:38:44 25 4
gpt4 key购买 nike

我在我的 android 项目中实现了 IabHelper 类,它说“getBuyIntentToReplaceSkus”无法解决。完整方法:

buyIntentBundle = mService.getBuyIntentToReplaceSkus(5,
mContext.getPackageName(),oldSkus, sku, itemType, extraData);

我在我的项目中实现了应用计费,但我还没有创建任何要购买的项目,尽管其余方法没有任何问题。

最佳答案

Google 示例项目中的aidl 与额外的“Google Play Billing”SDK 中包含的aidl 文件不同。我不知道他们为什么认为这是个好主意。只需将项目中的aidl 替换为示例项目中包含的aidl。这包含缺少的方法引用。您也可以将以下代码复制并粘贴到底部的aidl文件中:

    /**
* This API is currently under development.
*/
int stub(int apiVersion, String packageName, String type);

/**
* Returns a pending intent to launch the purchase flow for upgrading or downgrading a
* subscription. The existing owned SKU(s) should be provided along with the new SKU that
* the user is upgrading or downgrading to.
* @param apiVersion billing API version that the app is using, must be 5 or later
* @param packageName package name of the calling app
* @param oldSkus the SKU(s) that the user is upgrading or downgrading from,
* if null or empty this method will behave like {@link #getBuyIntent}
* @param newSku the SKU that the user is upgrading or downgrading to
* @param type of the item being purchased, currently must be "subs"
* @param developerPayload optional argument to be sent back with the purchase information
* @return Bundle containing the following key-value pairs
* "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response codes
* on failures.
* "BUY_INTENT" - PendingIntent to start the purchase flow
*
* The Pending intent should be launched with startIntentSenderForResult. When purchase flow
* has completed, the onActivityResult() will give a resultCode of OK or CANCELED.
* If the purchase is successful, the result data will contain the following key-value pairs
* "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response
* codes on failures.
* "INAPP_PURCHASE_DATA" - String in JSON format similar to
* '{"orderId":"12999763169054705758.1371079406387615",
* "packageName":"com.example.app",
* "productId":"exampleSku",
* "purchaseTime":1345678900000,
* "purchaseToken" : "122333444455555",
* "developerPayload":"example developer payload" }'
* "INAPP_DATA_SIGNATURE" - String containing the signature of the purchase data that
* was signed with the private key of the developer
* TODO: change this to app-specific keys.
*/
Bundle getBuyIntentToReplaceSkus(int apiVersion, String packageName,
in List<String> oldSkus, String newSku, String type, String developerPayload);

关于android - IabHelper 类不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34812890/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com