onIabPurchaseFinishedListener
アプリ内ダイアログで今すぐ購入をクリックしても、logcat は何も出力しません。
public class CreateAlbumActivity extends Activity {
IabHelper mHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_album);
mHelper = new IabHelper(this, Global.inapp);
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
// Oh noes, there was a problem.
// AlertDialogHelper.CreateNormalDialog(context, "Failed to set In-App Billing: " +result);
Log.d(Global.TAG, "Problem setting up In-app Billing: " + result);
return;
}
// Hooray, IAB is fully set up!
}
});
}
public void createAlbumEvent(){
mHelper.launchPurchaseFlow(CreateAlbumActivity.this, "android.test.purchased", 10001,
mPurchaseFinishedListener, "bGoa+V7g/yqDXvKRqq");
}
IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener
= new IabHelper.OnIabPurchaseFinishedListener() {
public void onIabPurchaseFinished(IabResult result, Purchase purchase)
{
if (result.isFailure()) {
Log.d(Global.TAG, "Error purchasing: " + result);
return;
}
Log.d(Global.TAG, "SUCCESS PURCHASE!");
}
};
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.d(Global.TAG, "onActivityResult(" + requestCode + "," + resultCode + "," + data);
// Pass on the activity result to the helper for handling
if (!mHelper.handleActivityResult(requestCode, resultCode, data)) {
// not handled, so handle it ourselves (here's where you'd
// perform any handling of activity results not related to in-app
// billing...
super.onActivityResult(requestCode, resultCode, data);
}
else {
Log.d(Global.TAG, "onActivityResult handled by IABUtil.");
}
}
}