2013. 8. 8. 15:06

InApp Billing Sample Test Program(Trivial Drive) 구입시의 Logic


1. Main의 onBuyGasButtonClicked 함수에서 mHelper(IanHelper)의 launchPurchaseFlow 호출


2. launchPurchaseFlow 함수에서 getBuyIntent 호출

Bundle buyIntentBundle = mService.getBuyIntent(3, mContext.getPackageName(), sku, itemType, extraData); 

int response = getResponseCodeFromBundle(buyIntentBundle);


3. 성공적으로 번들이 생성되었으면 결제창을 생성한다.

PendingIntent pendingIntent = buyIntentBundle.getParcelable(RESPONSE_BUY_INTENT); 

act.startIntentSenderForResult(pendingIntent.getIntentSender(), requestCode, new Intent(), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0));


4. 결제가 끝나면 Main의 onActivityResult() 호출되고 여기서 mHelper.handleActivityResult()호출

handleActivityResult 에서 결제여부를 파악하고, onIabPurchaseFinished() 호출하며 결제 데이터를 넘김(purchase)


5. Main 함수의 onIabPurchaseFinished 에서 결제된 item에 대한 확인을 한 뒤 consumeAsync 호출


6. consumePurchase() 호출후 onConsumeFinished()가 호출됨

'Computer Programming > Android' 카테고리의 다른 글

[Android] 안드로이드 스트링 비교  (0) 2015.09.24
[Android]BroadCast Err(Handler?)  (0) 2013.09.23
[Android]InApp Billing - 2  (0) 2013.08.08
[Android]InApp Billing - 1  (0) 2013.08.07
Posted by 은돌군