public void onBuyGasButtonClicked ( View arg0 ) { Log . d ( TAG , "Buy gas button clicked." ) ; if ( mSubscribedToInfiniteGas ) { complain ( "No need! You're subscribed to infinite gas. Isn't that awesome?" ) ; return ; } if ( mTank >= TANK_MAX ) { complain ( "Your tank is full. Drive around a bit!" ) ; return ; } if ( setupDone == null ) { complain ( "Billing Setup is not completed yet" ) ; return ; } if ( ! setupDone ) { complain ( "Billing Setup failed" ) ; return ; } // launch the gas purchase UI flow. // We will be notified of completion via mPurchaseFinishedListener setWaitScreen ( true ) ; Log . d ( TAG , "Launching purchase flow for gas." ) ; /* TODO: for security, generate your payload here for verification. See the comments on * verifyDeveloperPayload() for more info. Since this is a SAMPLE, we just use * an empty string, but on a production app you should carefully generate this. */ String payload = "" ; mHelper . launchPurchaseFlow ( this , InAppConfig . SKU_GAS , RC_REQUEST , mPurchaseFinishedListener , payload ) ; }
User clicked the Buy Gas button