簡體   English   中英

使用Android InApp Billing V3示例。 點擊購買,后退按鈕,再次購買會導致錯誤

[英]Using the Android InApp Billing V3 example. Hit Buy, Back Button, and buy again causes error

這是步驟:

  1. 構建並運行InApp V3示例Trivial Drive示例
  2. 選擇購買選項
  3. 點擊后退按鈕
  4. 再試一次

在截至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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM