use of sk.henrichg.phoneprofilesplus.DonationFragment in project PhoneProfilesPlus by henrichg.
the class BillingManager method startServiceConnectionIfNeeded.
private void startServiceConnectionIfNeeded(final Runnable executeOnSuccess) {
PPApplication.logE(TAG, "startServiceConnectionIfNeeded");
if (mBillingClient.isReady()) {
if (executeOnSuccess != null) {
executeOnSuccess.run();
}
} else {
DonationFragment fragment = getFragment();
if (fragment != null)
fragment.setWaitScreen(true);
mBillingClient.startConnection(new BillingClientStateListener() {
@Override
public void onBillingSetupFinished(@BillingClient.BillingResponse int billingResponse) {
if (billingResponse == BillingClient.BillingResponse.OK) {
if (executeOnSuccess == null) {
getFragment().updateGUIAfterBillingConnected();
}
if (executeOnSuccess != null) {
executeOnSuccess.run();
}
}
/* else {
Log.w(TAG, "onBillingSetupFinished() error code: " + billingResponse);
}*/
}
@Override
public void onBillingServiceDisconnected() {
// Log.w(TAG, "onBillingServiceDisconnected()");
}
});
}
}
Aggregations