در مطلب قبلی گفتم اگر برنامه کافه بازار بر روی گوشی نصب نباشه برنامه ما که پرداخت درون برنامه ای داره خطا میده و میپره بیرون.
من یک ترای کش گذاشتم مشکل حل شد
Log.d(TAG, "Starting setup.");
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
Log.d(TAG, "Setup finished.");
if (!result.isSuccess()) {
// Oh noes, there was a problem.
Log.d(TAG, "Problem setting up In-app Billing: " + result);
}
// Hooray, IAB is fully set up!
try {
mHelper.queryInventoryAsync(mGotInventoryListener) ;
} catch (Exception e){
Toast.makeText(getApplicationContext(), getString(R.string.nobazar), Toast.LENGTH_LONG).show();
dialog.hide();
}
}
آیا این روش بهترین روش هست یا نه؟