어쩌다 보니 v3 인앱관련 글을 많이 올리게 되네요..


BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED 에 락이 걸려서

미추어 버릴거 같다면..


대충 아래코드를 참고하세요 

빨간색 코드인 컨슘하는 부분을 launchPurchaseFlow() 이전에 호출해서 사용하세요~!!

launchPurchaseFlow()이후에 호출하면 어케 되느냐..

IllegalStateException 으로 깔끔하게 액티비티를 죽여버려주심..



billingHelper = new IabHelper(this, base64EncodedPublicKey);

billingHelper.enableDebugLogging(true, "#@#");

billingHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {

@Override

public void onIabSetupFinished(IabResult result) {

if (!result.isSuccess()) {

Log.e("#@#", "Problem setting up in-app billing: " + result);

skip = true;

return;

}

skip = false;

billingHelper.queryInventoryAsync(new IabHelper.QueryInventoryFinishedListener() {

public void onQueryInventoryFinished(IabResult result, Inventory inventory) {

Log.i("#@#", "onQueryInventoryFinished");


if (result.isFailure()) {

Log.e("#@#", "queryInventoryAsync Failed to query inventory: " + result);

if (dialog_progress != null) {

dialog_progress.dismiss();

dialog_progress = null;

}

return;

}


for (int i = 0; i < items.size(); i++) {

String pid = items.get(i).pId;

if (inventory.hasPurchase(items.get(i).pId)) {

Log.i("#@#", "queryInventoryAsync pid :  " + pid);

if (result.getResponse() == IabHelper.BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED) {

recoveryPurchase = inventory.getPurchase(items.get(i).pId);

}

}

}


}

});


복원

iif(recoveryPurchase != null)  {

billingHelper.consumeAsync(recoveryPurchaseconsumeFinishedListener);

}


복원루틴 쉽게 launchPurchaseFlow() 에서 처리 되는줄 알고 recoveryPurchase 찾아서 던저줬더니

앱을 죽여버려 주시네요..


니가 처리해 ~~ 이렇게 말야..ㅠㅠ