我尝试在我的应用程序中包含应用内结算并进行测试,基于应用程序计费版本3的"TrivialDrive"示例的整个过程(以及实现IAB文件中提供的未修改版本的IAB文件)演示文稿的"util"子目录),但它对我不起作用 - 在LogCat上,就在应用程序因错误而终止之前,它会显示消息"应用程序内计费错误:操作非法状态(launchPurchaseFlow):IAB Helper未设置. "(在startRegistered()函数被触发后,给我LOG消息"点击注册按钮;启动购买流程进行升级.")...
知道这里出了什么问题吗?
以下是我的代码的相关部分:
package com.mytest;
(..)
import com.mytest.iab.IabHelper; // the originals from the demo example, unmodified
import com.mytest.iab.IabResult;
import com.mytest.iab.Inventory;
import com.mytest.iab.Purchase;
public class Result3 extends Activity implements OnClickListener {
private static final String TAG = "BillingService";
private Context mContext;
boolean mIsRegistered = false;
// this has already been set up for my app at the publisher's console
static final String IS_REGISTERED = "myregistered";
static final int RC_REQUEST = 10001;
// The helper object
IabHelper …Run Code Online (Sandbox Code Playgroud) 我正在尝试在app结算中实施.我已经使用了trivialdrivesample.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// load game data
loadData();
String base64EncodedPublicKey = "my key";
// Create the helper, passing it our context and the public key to verify signatures with
Log.d(TAG, "Creating IAB helper.");
mHelper = new IabHelper(this, base64EncodedPublicKey);
// enable debug logging (for a production application, you should set this to false).
mHelper.enableDebugLogging(true);
// Start setup. This is asynchronous and the specified listener
// will be called once setup completes.
Log.d(TAG, "Starting setup.");
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() …Run Code Online (Sandbox Code Playgroud)