public void onQueryInventoryFinished(IabResult result, Inventory inventory) { if (result.isSuccess()) { if (inventory != null && inventory.getSkuDetails(productsList.get(0)) != null) { mHelper.consumeAsync( inventory.getPurchase(productsList.get(0)), mConsumeFinishedListener); } else if (inventory != null && inventory.getSkuDetails(productsList.get(1)) != null) { mHelper.consumeAsync( inventory.getPurchase(productsList.get(1)), mConsumeFinishedListener); } } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AppController.getController().getBus().register(this); manager = new GridLayoutManager(this, getResources().getInteger(R.integer.num_row)); recycler.setItemAnimator(new DefaultItemAnimator()); recycler.setHasFixedSize(true); recycler.setLayoutManager(manager); mDrawerLayout.setStatusBarBackgroundColor( AppHelper.getPrimaryDarkColor(AppHelper.getPrimaryColor(this))); navigationView.setItemIconTintList(ColorStateList.valueOf(AppHelper.getAccentColor(this))); if (AppHelper.isDarkTheme(this)) { navigationView.setItemTextColor(ColorStateList.valueOf(AppHelper.getAccentColor(this))); } adapter = new AppsAdapter(this, new ArrayList<AppsModel>()); recycler.setAdapter(adapter); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); if (navigationView != null) { setupDrawerContent(navigationView); } getLoaderManager().restartLoader(0, null, this); productsList.addAll(Arrays.asList(getResources().getStringArray(R.array.in_app_billing))); mHelper = new IabHelper(this, getString(R.string.base64)); mHelper.startSetup(mPurchaseFinishedListener); showWhatsNew(); countBackup(); }
@Override protected void onDestroy() { if (AppController.getController().getBus().isRegistered(this)) { AppController.getController().getBus().unregister(this); } if (mHelper != null) mHelper.dispose(); mHelper = null; super.onDestroy(); }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (!mHelper.handleActivityResult(requestCode, resultCode, data)) { super.onActivityResult(requestCode, resultCode, data); } }
private void onSuccessPaid() { mHelper.queryInventoryAsync(true, productsList, mReceivedInventoryListener); }