我在应用内购买中添加功能时遇到问题
当我使用试用帐户时,应用内购买成功。但是当我使用非试用帐户时,该产品不可用。
package com.pinisi.mobile.muslim.activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import com.anjlab.android.iab.v3.BillingProcessor;
import com.anjlab.android.iab.v3.TransactionDetails;
import com.pinisi.mobile.muslim.R;
import com.pinisi.mobile.muslim.utils.Utils;
public class DateConverter extends Utils implements BillingProcessor.IBillingHandler{
BillingProcessor bp;
Button purchaseBtn;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_converter);
Actionbar(getString(R.string.lbl_date));
Analytics(getString(R.string.lbl_date));
typeface();
bp = new BillingProcessor(this, "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhVEauYfr37GDYVr2np3QI8JsjpvHlQdilxYXvMCdVtNNnvUjjJJtj0OmET3EdQ8t/3SUwKPEfhaLMjIY9C5LDHeODHUa6tzfoY+1EuNGsN3sn/QcdmeqhSSHTWIFlavo7FQ009cU3ayN64S8ofq+xXiKDZBoeBAh3dtHPibiMmnsJ2N4iULCnJXULwKaJ3nq2vyez+0IIKYD1mLnn8kNe+lwX3UsGk1bD0I6cDgH8BW0FgyCH5uS+TNODDL7vIH4lqmknLKVFZ1a2xOiK95UVNKjbz7LKPo1OPbk3pR/Lyk8XWBveE6AMBDctx6SLjeHXwWcSAjXqTj3NWHERdfbLQIDAQAB", this);
bp.initialize();
// or bp = BillingProcessor.newBillingProcessor(this, "YOUR LICENSE KEY FROM GOOGLE PLAY CONSOLE HERE", this);
// See below on why this is a useful alternative
purchaseBtn = findViewById(R.id.button_donasi);
purchaseBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bp.purchase(DateConverter.this, "23000_donasi");
bp.consumePurchase("23000_donasi");
}
});
}
// IBillingHandler implementation
@Override
public void onBillingInitialized() {
/*
* Called when BillingProcessor was initialized and it's ready to purchase
*/
}
@Override
public void onProductPurchased(String productId, @Nullable TransactionDetails details) {
Toast.makeText(getBaseContext(),"Produk yang dibeli dan id produk adalah = "+productId,Toast.LENGTH_SHORT).show();
/*
* Called when requested PRODUCT ID was successfully purchased
*/
}
@Override
public void onBillingError(int errorCode, @Nullable Throwable error) {
Toast.makeText(getBaseContext(),"Kesalahan pembelian produk",Toast.LENGTH_SHORT).show();
/*
* Called when some error occurred. See Constants class for more details
*
* Note - this includes handling the case where the user canceled the buy dialog:
* errorCode = Constants.BILLING_RESPONSE_RESULT_USER_CANCELED
*/
}
@Override
public void onPurchaseHistoryRestored() {
/*
* Called when purchase history was restored and the list of all owned PRODUCT ID's
* was loaded from Google Play
*/
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (!bp.handleActivityResult(requestCode, resultCode, data)) {
super.onActivityResult(requestCode, resultCode, data);
}
}
@Override
public void onDestroy() {
if (bp != null) {
bp.release();
}
super.onDestroy();
}
}
上面的代码中我想念什么吗?
如果这不是代码错误,请帮助解决问题