Java Code Examples for com.anjlab.android.iab.v3.BillingProcessor#isIabServiceAvailable()

The following examples show how to use com.anjlab.android.iab.v3.BillingProcessor#isIabServiceAvailable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BillingService.java    From fingen with Apache License 2.0 4 votes vote down vote up
public boolean isBillingAvailable() {
    return BillingProcessor.isIabServiceAvailable(FGApplication.getAppComponent().getContext());
}
 
Example 2
Source File: BillingActivity.java    From IslamicLibraryAndroid with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    ((IslamicLibraryApplication) getApplication()).refreshLocale(this, false);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_billing);
    ButterKnife.bind(this);

    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setDisplayShowTitleEnabled(true);
        getSupportActionBar().setTitle(R.string.financial_aid);
    }

    if (!BillingProcessor.isIabServiceAvailable(this)) {
        showToast(R.string.iap_not_available);
    }

    bp = new BillingProcessor(this, LICENSE_KEY, new BillingProcessor.IBillingHandler() {
        @Override
        public void onProductPurchased(@NonNull String productId, @Nullable TransactionDetails details) {
            billingItemsRecyclerViewAdapter.notifyProductPurchased(productId, details);
        }

        @Override
        public void onBillingError(int errorCode, @Nullable Throwable error) {
            Timber.e(error);
            // showToast("onBillingError: " + Integer.toString(errorCode));
        }

        @Override
        public void onBillingInitialized() {
            readyToPurchase = true;
            billingItemsRecyclerViewAdapter.setReadyToPurchase(true);
            billingItemsRecyclerViewAdapter.notifyDataSetChanged();
        }

        @Override
        public void onPurchaseHistoryRestored() {
            billingItemsRecyclerViewAdapter.notifyDataSetChanged();
        }
    });
    billingItemsRecyclerViewAdapter = new BillingItemsRecyclerViewAdapter(this);
    recyrecyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyrecyclerView.setHasFixedSize(true);
    recyrecyclerView.setAdapter(billingItemsRecyclerViewAdapter);
    mIsArabic = Util.isArabicUi(this);

}
 
Example 3
Source File: InAppBillingBridge.java    From react-native-billing with MIT License 4 votes vote down vote up
private Boolean isIabServiceAvailable() {
    return BillingProcessor.isIabServiceAvailable(_reactContext);
}