我在我的应用程序中使用应用程序内计费。下面是我用过的代码请求包。
protected Bundle makeRequestBundle(String method) {
Bundle request = new Bundle();
request.putString(BILLING_REQUEST, method);
request.putInt(API_VERSION, 1);
request.putString(PACKAGE_NAME, getPackageName());
return request;
}
以下是我用于购买请求的代码。
Bundle response = mService.sendBillingRequest(request);
Integer responseCodeIndex = (Integer) response.get("RESPONSE_CODE");
PendingIntent pendingIntent = (PendingIntent)
response.get("PURCHASE_INTENT");
PendingIntent pendingIntent1 = (PendingIntent) response.get("BUY_INTENT");
Long requestIndentifier = (Long) response.get("REQUEST_ID");
BillingConstants.ResponseCode responseCode =
BillingConstants.ResponseCode.valueOf(responseCodeIndex);
Log.i(TAG, "REQUEST_PURCHASE Sync Response code: "+responseCode.toString());
此代码出错,Android 5.0无法提供服务