In-App Billing isBillingSupported - 返回什么和功能如何?

时间:2014-11-20 09:17:49

标签: android in-app-billing

该问题基于适用于Android的Google应用内结算服务。特别是函数isBillingSupported

int result = mBillingService.isBillingSupported(3, mOwner.getPackageName(), "inapp")

首先,这个函数返回了什么?这些文档非常隐秘:

  

成功时RESULT_OK(0),失败时对应的结果代码

only codes I found似乎与支持结算问题无关。所有看起来具体的,是0是成功的。有什么错误?

其次,该功能检查是否支持计费?我有一个完全能够进行应用程序内计费的手机,而且这个功能确实可以返回" true"当我连接到合理的互联网来源,如WiFi。但是,如果我的连接不稳定,它将不会返回" true"。所以我假设它检查一个良好的连接。还有什么检查?

2 个答案:

答案 0 :(得分:6)

其他回复代码为: -

  • RESULT_OK = 0 - 成功
  • RESULT_USER_CANCELED = 1 - 用户按下或取消了对话框
  • RESULT_BILLING_UNAVAILABLE = 3 - 请求的类型不支持此结算API版本
  • RESULT_ITEM_UNAVAILABLE = 4 - 请求的SKU无法购买
  • RESULT_DEVELOPER_ERROR = 5 - 提供给API的无效参数
  • RESULT_ERROR = 6 - API操作期间出现致命错误
  • RESULT_ITEM_ALREADY_OWNED = 7 - 由于商品已经拥有而未能购买
  • RESULT_ITEM_NOT_OWNED = 8 - 由于项目不属于
  • ,因此无法使用

答案 1 :(得分:-3)

public int isBillingSupported(int apiVersion, java.lang.String packageName, java.lang.String type) throws android.os.RemoteException;

/**
     * Provides details of a list of SKUs
     * Given a list of SKUs of a valid type in the skusBundle, this returns a bundle
     * with a list JSON strings containing the productId, price, title and description.
     * This API can be called with a maximum of 20 SKUs.
     * @param apiVersion billing API version that the Third-party is using
     * @param packageName the package name of the calling app
     * @param skusBundle bundle containing a StringArrayList of SKUs with key "ITEM_ID_LIST"
     * @return Bundle containing the following key-value pairs
     *         "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on
     *              failure as listed above.
     *         "DETAILS_LIST" with a StringArrayList containing purchase information
     *              in JSON format similar to:
     *              '{ "productId" : "exampleSku", "type" : "inapp", "price" : "$5.00",
     *                 "title : "Example Title", "description" : "This is an example description" }'
     */