onIabPurchaseFinishedListener never gets called
My onIabPurchaseFinishedListener never gets called, even though I click
the buy now in the inapp dialog, the logcat doesn't print anything.
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);
}
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.");
}
}
}
No comments:
Post a Comment