每当启动支付服务时一切正常,但在活动结果中得到错误
关于活动结果
RESulT_OK = 0和resultCode = -1在样例中如预期的那样,但我不知道哪里出错了..
if (Navigator.REQUEST_PAsspORT_PURCHASE == requestCode) { if (RESulT_OK == resultCode) { dealWithSuccessfulPurchase(); } else { dealWithFailedPurchase(); } }
否则控制权在其他地方……
解决方法:
检查我的下面的代码:
@OverrIDe protected voID onActivityResult(int requestCode, int resultCode, Intent data) { Log.d(TAG, "onActivityResult(" + requestCode + "," + resultCode + "," + data); if (mHelper == null) return; if (requestCode == 10001) { int responseCode = data.getIntExtra("RESPONSE_CODE", 0); String purchaseData = data.getStringExtra("INAPP_PURCHASE_DATA"); Log.d("INAPP_PURCHASE_DATA", ">>>" + purchaseData); String dataSignature = data.getStringExtra("INAPP_DATA_SIGNATURE"); Log.d("INAPP_DATA_SIGNATURE", ">>>" + dataSignature); String continuationToken = data .getStringExtra("INAPP_CONTINUATION_TOKEN"); Log.d("INAPP_CONTINUATION_TOKEN", ">>>" + continuationToken); if (resultCode == RESulT_OK) { try { Log.d("purchaseData", ">>>"+purchaseData); JsONObject jo = new JsONObject(purchaseData); String sku = jo.getString("productID"); alert("You have bought the " + sku + ". Excellent choice, adventurer!"); } catch (JsONException e) { alert("Failed to parse purchase data."); e.printstacktrace(); } } else if (resultCode == RESulT_CANCELED) { // } else if (resultCode == RESulT_CANCELED) { Toast.makeText(AppMainTest.this, "Sorry, you have canceled purchase Subscription.", Toast.LENGTH_SHORT).show(); } else if (resultCode == IabHelper.BILliNG_RESPONSE_RESulT_ITEM_ALREADY_OWNED) { Toast.makeText(AppMainTest.this, "Item already owned", Toast.LENGTH_SHORT).show(); } } }
希望它能解决你的问题.
总结以上是内存溢出为你收集整理的android – 活动结果中的应用内结算-v3错误全部内容,希望文章能够帮你解决android – 活动结果中的应用内结算-v3错误所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)