[英]Using the Android InApp Billing V3 example. Hit Buy, Back Button, and buy again causes error
這是步驟:
在截至2013年1月的版本中,您可能會收到
無法啟動異步操作(launchPurchaseFlow),因為另一個異步操作(launchPurchaseFlow)正在進行中。
然后你不能使用IabHelper類的購買或庫存方法,因為async標志不會清除,除非你殺死你的應用程序。
這是一個可能的解決方案:
我將flagEndAsync方法設為public,並在onRestart方法中調用它。 問題是:這是一個安全的解決方案嗎? 還有其他人看過這個問題嗎?
這是我添加的內容:
protected void onRestart() {
super.onRestart();
if (mHelper != null) mHelper.flagEndAsync();
}
您確定沒有刪除以下代碼(或忘記添加到您的活動中)
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent 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);
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.