use of com.android.billingclient.api.BillingClientStateListener in project apcupsd-monitor by norkator.
the class MainMenu method initInAppBilling.
// ---------------------------------------------------------------------------------------------
/* In app billing features */
// Initialize in app billing feature
private void initInAppBilling() {
// In app billing
mBillingClient = BillingClient.newBuilder(this).enablePendingPurchases().setListener(this).build();
mBillingClient.startConnection(new BillingClientStateListener() {
@Override
public void onBillingSetupFinished(BillingResult billingResult) {
if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK) {
// The billing client is ready. You can query purchases here.
}
}
@Override
public void onBillingServiceDisconnected() {
// Try to restart the connection on the next request to
// Google Play by calling the startConnection() method.
}
});
}
Aggregations