Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/180.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 应用内计费isBillingSupported-返回什么功能以及如何返回?_Android_In App Billing - Fatal编程技术网

Android 应用内计费isBillingSupported-返回什么功能以及如何返回?

Android 应用内计费isBillingSupported-返回什么功能以及如何返回?,android,in-app-billing,Android,In App Billing,这个问题是围绕谷歌Android应用内计费服务提出的。具体而言,支持的是功能isbillings int result = mBillingService.isBillingSupported(3, mOwner.getPackageName(), "inapp") 首先,这个函数返回什么?这些文件在这方面秘密得令人难以置信: 成功时结果_OK(0),失败时相应的结果代码 这个问题似乎与账单是否得到支持无关。所有看起来具体的是,0是成功的。会有什么错误 其次,该函数检查什么以了解是否支持计费?

这个问题是围绕谷歌Android应用内计费服务提出的。具体而言,支持的是功能
isbillings

int result = mBillingService.isBillingSupported(3, mOwner.getPackageName(), "inapp")
首先,这个函数返回什么?这些文件在这方面秘密得令人难以置信:

成功时结果_OK(0),失败时相应的结果代码

这个问题似乎与账单是否得到支持无关。所有看起来具体的是,0是成功的。会有什么错误


其次,该函数检查什么以了解是否支持计费?我有一部手机,完全可以进行应用内计费,当我连接到合理的互联网资源(如WiFi)时,该功能确实会返回“true”。然而,如果我的连接不太稳定,它将不会返回“true”。所以我假设它检查一个良好的连接。它还检查什么?

其他响应代码为:-

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" }'
     */
  • 结果\u OK=0-成功
  • RESULT\u USER\u cancelled=1-用户按下或取消对话框
  • 结果\u计费\u不可用=3-请求的类型不支持此计费API版本
  • 结果\u项目\u不可用=4-请求的SKU不可购买
  • RESULT\u DEVELOPER\u ERROR=5-提供给API的参数无效
  • 结果_ERROR=6-API操作期间出现致命错误
  • 结果\u项目\u已拥有=7-由于项目已拥有,无法购买
  • RESULT_ITEM_NOT_OWNED=8-无法消费,因为ITEM NOT OWNED

它不能只检查服务版本,因为根据我是否打开WiFi或3G或3G(但接收效果非常差),它返回的结果会有所不同。我知道0表示成功的返回代码,但还有什么其他的吗?这是错误的注释(对应于getSkuDetails)。我以前读过这些注释,但我认为它们是用于事务的。它们是否适用于整个API?当查询是否可以计费时,已经拥有的没有任何意义。你知道计费支持函数检查什么吗?是的,它们用于整个API。此功能实际上检查您正在使用应用内购买购买的商品是否支持应用内计费。在这里,支持意味着项目是否可供购买。因此,前面答案中所写的代码适用于该场景,即如果用户已经拥有该商品,商品SKU不可用或不正确等。