Java Android应用内计费v3。onActivityResult
启动采购流程后,onActivityResult方法需要什么 从普通驱动器示例中:Java Android应用内计费v3。onActivityResult,java,android,in-app-billing,onactivityresult,Java,Android,In App Billing,Onactivityresult,启动采购流程后,onActivityResult方法需要什么 从普通驱动器示例中: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (mHelper == null) return; // Pass on the activity result to the helper for handling if (!mHelper.hand
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (mHelper == null) return;
// 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(TAG, "onActivityResult handled by IABUtil.");
}
}
“在这里,您可以执行与应用内计费无关的任何活动结果处理”
这是否意味着您需要更新用户的库存或显示警报框?如果是这样,我已经在OnConsumeFinishedListener中执行了此操作。我已经测试了我的代码,将onActivityResult方法保留为如上所述,它看起来很好。这可能会导致任何问题吗
或者这是否意味着我必须为购买的SKU手动调用consume方法?如果您不必在活动中处理其他结果,那么您的代码就可以了。 想象一个活动,例如使用startActivityForResult()启动其他活动。 这是处理那些“与应用内计费无关”结果的地方 但是,您应该将代码更改为:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// Pass on the activity result to the helper for handling
if (mHelper==null || !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...
}
else {
Log.d(TAG, "onActivityResult handled by IABUtil.");
}
super.onActivityResult(requestCode, resultCode, data);
}
帮了我,谢谢。