我正在开发应用内计费模块。但是还是有一些问题。
1)我已经实现了许可证验证库(LVL)。一切都像示例应用程序一样完成并成功测试。但我收到错误消息:“免费应用程序不允许 CHECK_LICENSE 权限。” 将应用程序上传到市场时。我认为我需要实施 LVL,因为它与 billing-in-app 的相关安全问题。但似乎 LVL 仅适用于付费应用程序。我的应用程序是免费的,并且包含在应用程序模块中的计费。什么时候可以免费使用应用程序?
2)当付款成功处理时,我已经实现了如下的应用程序计费模块(将调用购买的InApp()方法):
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
}
}
}
以上实现的方法在主线程中调用?还是它是分开的线程?
提前致谢。