我在编码付款时遇到问题。
这是一个网页游戏,这就是我希望付款的方式。
你到了一个网站,然后点击一个按钮(购买)。您将被重定向到一个站点,该站点会将购买信息发送到服务器,并将购买的物品添加到您的帐户中。在此之前,我们有一个 WebViewClient 来检查所有的 url。如果他找到一个用于购买的 url,他将发送购买请求。现在,如果我们从 android 市场收到一条成功的消息,他将继续进行重定向。
我对此很陌生,只是无法理解这些付款的概念。我使用地牢示例编写了我的代码。我试图根据我的需要调整它。如果有人能指出我正确的方向,我将不胜感激。Atm 我试图弄清楚如何获得成功购买的响应。假设我的其余代码没问题,它应该可以工作(我希望)。
我的项目文件中包含示例中的 BillingReciver.java、BillingSerivce.java、PurchaseObserver.java、ResponseHandler.java、Consts.java 和 Security.java。如果需要,我可以提供这些代码,但其中有很多,所以我希望已经看过该示例的人能够提供帮助。
在与一些人进行一些研究和咨询后,我发现了我需要的东西:
/**
* This is called when Android Market sends information about a purchase state
* change. The signedData parameter is a plaintext JSON string that is
* signed by the server with the developer's private key. The signature
* for the signed data is passed in the signature parameter.
* @param context the context
* @param signedData the (unencrypted) JSON string
* @param signature the signature for the signedData
*/
private void purchaseStateChanged(Context context, String signedData, String signature) {
Intent intent = new Intent(Consts.ACTION_PURCHASE_STATE_CHANGED);
intent.setClass(context, BillingService.class);
intent.putExtra(Consts.INAPP_SIGNED_DATA, signedData);
intent.putExtra(Consts.INAPP_SIGNATURE, signature);
context.startService(intent);
}
我需要从我的应用程序将从 android 市场获得的 JSON 字符串中获取数据。任何人都知道如何做到这一点?