Java Code Examples for com.anjlab.android.iab.v3.BillingProcessor#IBillingHandler
The following examples show how to use
com.anjlab.android.iab.v3.BillingProcessor#IBillingHandler .
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: DonateActivity.java From GPS2SMS with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ShowBackButton(); setContentView(R.layout.activity_donate); bp = new BillingProcessor(DonateActivity.this, LICENSE_KEY, new BillingProcessor.IBillingHandler() { @Override public void onProductPurchased(String productId, TransactionDetails details) { //DBHelper.ShowToastT(DonateActivity.this, "onProductPurchased: " + productId, Toast.LENGTH_LONG); refreshPurchasesStatus(); } @Override public void onBillingError(int errorCode, Throwable error) { // DBHelper.ShowToastT(DonateActivity.this, "onBillingError: " + Integer.toString(errorCode), Toast.LENGTH_LONG); refreshPurchasesStatus(); } @Override public void onBillingInitialized() { readyToPurchase = true; DonatePriceTextLoadAsyncTask mt = new DonatePriceTextLoadAsyncTask(); mt.execute(); } @Override public void onPurchaseHistoryRestored() { //DBHelper.ShowToastT(DonateActivity.this, "onPurchaseHistoryRestored", Toast.LENGTH_LONG); refreshPurchasesStatus(); } }); // ListView on Fragments DonateListFragment fragment = new DonateListFragment(); getSupportFragmentManager().beginTransaction().replace(R.id.frgmCont, fragment).commit(); }
Example 2
Source File: BillingActivity.java From IslamicLibraryAndroid with GNU General Public License v3.0 | 4 votes |
@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: App.java From Phonograph with GNU General Public License v3.0 | 4 votes |
@Override public void onCreate() { super.onCreate(); app = this; // default theme if (!ThemeStore.isConfigured(this, 1)) { ThemeStore.editTheme(this) .primaryColorRes(R.color.md_indigo_500) .accentColorRes(R.color.md_pink_A400) .commit(); } // Set up dynamic shortcuts if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { new DynamicShortcutManager(this).initDynamicShortcuts(); } // automatically restores purchases billingProcessor = new BillingProcessor(this, App.GOOGLE_PLAY_LICENSE_KEY, new BillingProcessor.IBillingHandler() { @Override public void onProductPurchased(@NonNull String productId, TransactionDetails details) { } @Override public void onPurchaseHistoryRestored() { if (App.isProVersion()) { App.notifyProVersionChanged(); } } @Override public void onBillingError(int errorCode, Throwable error) { } @Override public void onBillingInitialized() { App.loadPurchases(); // runs in background } }); }