应用内计费问题

发布于 2024-11-08 06:51:22 字数 1811 浏览 0 评论 0原文

我正在开发应用内计费模块。但仍然存在一些问题。

1)我已经实现了许可证验证库(LVL)。一切都像示例应用程序一样完成并测试成功。但我收到错误消息:“免费应用程序不允许 CHECK_LICENSE 权限。”将应用程序上传到市场时。 我认为我需要实施 LVL,因为它与 billing-in-app 的安全问题相关。但LVL似乎只适用于付费应用。我的应用程序是免费的,并在应用程序模块中包含计费。什么时候可以免费使用应用程序?

2)当付款处理成功时,我已经实现了应用内计费模块,如下所示(将调用purchasedInApp()方法):

private class MyAppPurchaseObserver extends PurchaseObserver {

   public MyAppPurchaseObserver(Handler handler) {
        super(MyAppPurchaseObserver.this, handler);
    }

    @Override
    public void onBillingSupported(boolean supported) {
        //Doing something
    }

    @Override
    public void onPurchaseStateChange(PurchaseState purchaseState, String itemId,
            int quantity, long purchaseTime, String developerPayload) {

        if(purchaseState == PurchaseState.PURCHASED) {
            purchasedInApp();
        }
    }

    @Override
    public void onRequestPurchaseResponse(RequestPurchase request,
            ResponseCode responseCode) {

        if (responseCode == ResponseCode.RESULT_OK) {
           //OK
        } else if (responseCode == ResponseCode.RESULT_USER_CANCELED) {
           //Canceled
        } else if(responseCode == ResponseCode.RESULT_BILLING_UNAVAILABLE ||
            responseCode == ResponseCode.RESULT_ITEM_UNAVAILABLE ||
            responseCode == ResponseCode.RESULT_SERVICE_UNAVAILABLE ||
            responseCode == ResponseCode.RESULT_DEVELOPER_ERROR) {
            //Error
        } else {
            //Fail
        }
    }

    @Override
    public void onRestoreTransactionsResponse(RestoreTransactions request,
            ResponseCode responseCode) {
        if (responseCode == ResponseCode.RESULT_OK) {
            //OK
        } else {
            //Error
        }
    }
}

上面实现的方法在主线程中调用? 或者是分离的线程?

提前致谢。

I am developing billing-in-app module. But still having some issues.

1) I've implemented License Verification Library(LVL). All done like sample application and tested successfully. But I got error message that : "CHECK_LICENSE permission is not allowed for free application." when upload the app to the market.
I thought that I need to implement LVL because it is related security issue of billing-in-app . But it seems that LVL is only for Paid Application. My application is free and included billing in app module. When it is available for free app ?

2) I've implemented billing-in-app module like the following when payment processed successfully (will call purchasedInApp() method):

private class MyAppPurchaseObserver extends PurchaseObserver {

   public MyAppPurchaseObserver(Handler handler) {
        super(MyAppPurchaseObserver.this, handler);
    }

    @Override
    public void onBillingSupported(boolean supported) {
        //Doing something
    }

    @Override
    public void onPurchaseStateChange(PurchaseState purchaseState, String itemId,
            int quantity, long purchaseTime, String developerPayload) {

        if(purchaseState == PurchaseState.PURCHASED) {
            purchasedInApp();
        }
    }

    @Override
    public void onRequestPurchaseResponse(RequestPurchase request,
            ResponseCode responseCode) {

        if (responseCode == ResponseCode.RESULT_OK) {
           //OK
        } else if (responseCode == ResponseCode.RESULT_USER_CANCELED) {
           //Canceled
        } else if(responseCode == ResponseCode.RESULT_BILLING_UNAVAILABLE ||
            responseCode == ResponseCode.RESULT_ITEM_UNAVAILABLE ||
            responseCode == ResponseCode.RESULT_SERVICE_UNAVAILABLE ||
            responseCode == ResponseCode.RESULT_DEVELOPER_ERROR) {
            //Error
        } else {
            //Fail
        }
    }

    @Override
    public void onRestoreTransactionsResponse(RestoreTransactions request,
            ResponseCode responseCode) {
        if (responseCode == ResponseCode.RESULT_OK) {
            //OK
        } else {
            //Error
        }
    }
}

Above implemented methods are called in main thread ?
Or is it separated thread ?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小鸟爱天空丶 2024-11-15 06:51:22

据我所知,LVL和应用内计费是相互独立的。他们唯一共享的是他们使用您的公钥进行验证。对于应用内结算,您的应用需要使用 com.android.vending.BILLING 权限构建。

计费请求异步发送到手机上的另一个应用程序(Android Market 或 MyApps,具体取决于手机)。我不认为请求发出方法会阻塞,因此可以在 UI 线程或后台线程上运行它们。我不知道响应回调是否在 UI 线程上,但我对此表示怀疑(因为它们不适用于 LVL)。

As far as I know, LVL and in-app billing are independent of one another. The only thing they share is that they use your public key for verification. For in-app billing, your app needs to be built with the com.android.vending.BILLING permission.

The billing requests are sent asynchronously to another app on the phone (Android Market or MyApps, depending on the phone). I don't believe that the request issuing methods block, so it's okay to run them on the UI thread or on a background thread. I don't know if the response call-backs are on the UI thread, but I doubt it (since they aren't for LVL).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文