应用程序购买中的v3库:如何使下载成为可能Android的

时间:2017-06-24 09:43:54

标签: android in-app-purchase

我的问题是我不知道如何下载升级版本,而且我不知道必须在哪里放置升级版本的代码。

这是我https://github.com/anjlab/android-inapp-billing-v3的代码:

BillingProcessor bp;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.upgrade);
    setTitle("Upgrade");
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);

    bp = new BillingProcessor(this, "/*Here's my license key from GooglePlay*/", this);

    Button buy = (Button) findViewById((R.id.buy));
    buy.setOnClickListener(new View.OnClickListener(){
        @Override
        public void onClick (View view) {
            bp.purchase(upgrade.this, "upgrade");
        }
    });
}

// IBillingHandler implementation

@Override
public void onBillingInitialized() {
/*
* Called when BillingProcessor was initialized and it's ready to purchase
*/
}

@Override
public void onProductPurchased(String productId, TransactionDetails details) {
/*
* Called when requested PRODUCT ID was successfully purchased
*/
}

@Override
public void onBillingError(int errorCode, Throwable error) {
/*
* 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();
}

我现在的问题是如何下载此升级?哪里必须是升级版的代码?

感谢您的回答!

0 个答案:

没有答案