質問

わかりました、私はこれを何日も修正しようとしていました。私はここに来て、私がトラブルシューティングをしていて、ログキャットのすべてのエラーメッセージを修正しているので、私のために仕事をする人を探していません。 Androidゲームを使用してAndroidゲームを開発しています(これは問題の一部である可能性があるため、慣れることができます)。私はあまりにも派手なことをしていません。私のゲームアクティビティはすべてシングルシーンであり、物理学など、スプライトやテクスチャの束を持っていません。また、ゲーム内の他のすべてのアクティビティにAndengineを使用しました。これは、グラフィカルな魅力的なスクリーンをセットアップする非常に簡単な方法であると感じているからです。そのような画面の1つは、ユーザーがレベルパックと新しいスプライトを購入できる私のアプリ内店です。これのすべての請求部分はすべてうまく機能し、購入は市場に進出し、そこにあまりにも複雑なことはありません...

ユーザーが[購入]をクリックすると、マーケット画面がポップアップ表示され、選択した製品がロードされます(ゲームは公開されていませんが、Androidテストではなく、実際の製品です)。ゲームのスタックの一部である「Android 2.0」実装を使用するか、「Android 1.6」の実装を使用し、独自のスタックの一部であるかどうかに関係なく、現在のアクティビティにマーケット画面がポップアップします。 Android 2.0の実装を使用することを好みますが、1.6しか取得できない場合は、それを取ります。とにかく、ユーザーがバックボタンを使用して購入をキャンセルするか、クレジットカードで購入を完了すると問題が発生します。外に出て、力が閉じます)。購入はOKですが、ゲーム内のユーザーのアイテムを変更するためにコードに到達する前にゲームの力が終了するため、ユーザーは製品を取得しません。いくつかのコードには、このチュートリアル(http://www.anddev.org/advanced-tutorials-f21/simple-inapp-billing-payment-t52060.html)を使用しました。 BillingHelperクラスは、RequestPurchase()メソッドとStartBuyPageActivity()メソッドを保持するため、最も重要です。私はこのようなストアフロントアクティビティからのリクエスト購入を呼び出します:

            BillingHelper.requestPurchase(StoreFront.this, itemID); 

そして、ストアフロントの作成者には、私はこのようなものを持っています(TUTによって行うように言われたように):

        startService(new Intent(mContext, BillingService.class));
    BillingHelper.setCompletedHandler(mTransactionHandler);

...

//some handler that billing needs
public Handler mTransactionHandler = new Handler(){
    public void handleMessage(android.os.Message msg) {
        Log.i(TAG, "Transaction complete");
        Log.i(TAG, "Transaction status: "+BillingHelper.latestPurchase.purchaseState);
        Log.i(TAG, "Item purchased is: "+BillingHelper.latestPurchase.productId);

        if(BillingHelper.latestPurchase.isPurchased()){
            //TODO do something here if we've completed our latest purchase,
            //this should be with the status bar notifications and
            //saved preferences
        }
    };

};

だから私は問題がそこにあるとは思わない。 Billinghelperの関連部分は次のとおりです

protected static void requestPurchase(Context activityContext, String itemId){
    if (amIDead()) {
        return;
    }
    Log.i(TAG, "requestPurchase()");
    Bundle request = makeRequestBundle("REQUEST_PURCHASE");
    request.putString("ITEM_ID", itemId);
    try {
        Bundle response = mService.sendBillingRequest(request);

        //The RESPONSE_CODE key provides you with the status of the request
        Integer responseCodeIndex   = (Integer) response.get("RESPONSE_CODE");
        //The PURCHASE_INTENT key provides you with a PendingIntent, which you can use to launch the checkout UI
        PendingIntent pendingIntent = (PendingIntent) response.get("PURCHASE_INTENT");
        //The REQUEST_ID key provides you with a unique request identifier for the request
        Long requestIndentifier     = (Long) response.get("REQUEST_ID");
        Log.i(TAG, "current request is:" + requestIndentifier);
        C.ResponseCode responseCode = C.ResponseCode.valueOf(responseCodeIndex);
        Log.i(TAG, "REQUEST_PURCHASE Sync Response code: "+responseCode.toString());

        startBuyPageActivity(pendingIntent, new Intent(), activityContext);
    } catch (RemoteException e) {
        Log.e(TAG, "Failed, internet error maybe", e);
        Log.e(TAG, "Billing supported: "+isBillingSupported());
    }
}

StoreFront.this、getApplicationContext()、他の場所に静的コンテキストストア、他の場所に保存されている静的アクティビティ、getBaseContext()などの「ActivityContext」など、さまざまな引数でStoreFrontから電話をかけようとしました...

これが他の関連活動です

private static void startBuyPageActivity(PendingIntent pendingIntent, Intent intent, Context context){
    //android 1.6 method
    try {
        pendingIntent.send(context, 0, intent);         
    } catch (CanceledException e){
        Log.e(TAG, "startBuyPageActivity CanceledException");
    }
}

派手なことは何もありません。ユーザーが、プロセス中にアイテムを購入するか、押し戻すときに、ユーザーが私のさまざまなアクティビティ(できればストアフロント)に戻ってくることを望んでいます。助けてください!

編集:購入が完了した後、最も厄介なソリューションでさえ、アプリ内請求がアプリに戻ることを可能にする可能性のあるソリューションが必要です。

編集

問題のログキャットとメソッド呼び出し:

  "BillingService Starting", 
  BillingHelper.setCompletedHandler(), 
  StoreFront.onStart() called, 
  StoreFront.onResume() called, 
  "BillingService Service starting with onCreate", 
  "BillingService Market Billing Service Successfully Bound", 
  "BillingService Market Billing Service Connected", 
  BillingHelper.instantiateHelper(), 
  then this is where I actually click the buy button in the store (all of that runs just when opening StoreFront):
  BillingHelper.setCompletedHandler(), 
  BillingHelper.isBillingSupported(), 
  BillingHelper.amIDead(), 
  BillingHelper.makeRequestBundle(), 
  "BillingService isBillingSupported response was: RESULT OK", 
  BillingHelper.requestPurchase(), 
  BillingHelper.amIDead(), 
  "BillingService requestPurchase()", 
  BillingHelper.makeRequestBundle(), 
  "BillingService current request is ......", 
  "BillingService REQUEST PURCHASE Sync Response code: RESULT OK", 
  BillingHelper.startBuyPageActivity(), 
  "BillingService Recieved action: com.android.vending.billing.RESPONSE CODE", 
  "BillingService checkResponseCode got requestID..."
  "BillingService checkResponseCode go responseCode RESULT ERROR" 
  (this is because I can't purchase on this device), 
  and then I get an Error message saying: "E 32427 Surface surface (identity=5925) is invalid, err=-19 (No such device)" and from there nothing works anymore. 

また、私はこれを別の電話でテストしました(一緒に仕事をしている別の開発者、実際に物を購入できるが、それでも黒い画面のエラーを取得できます)。

編集:エラーがどこにあるかを推測しなければならなかった場合、これだと思います

06-16 11:20:23.635: DEBUG/dalvikvm(3807): GC_EXPLICIT freed 53K, 45% free 3710K/6663K, external 1K/513K, paused 102ms
06-16 11:20:23.885: ERROR/Surface(3807): surface (identity=158) is invalid, err=-19 (No such device)
06-16 11:20:23.905: ERROR/Surface(3807): surface (identity=158) is invalid, err=-19 (No such device)
06-16 11:20:23.905: ERROR/Surface(3807): surface (identity=158) is invalid, err=-19 (No such device)
06-16 11:20:23.905: ERROR/Adreno200-EGL(3807): egliSwapWindowSurface: unable to dequeue native buffer

中断された例外は、Andengineライブラリによって予想されるため、それは赤いニシンであることに注意してください。

また、(これがここで許可されていることを願っています)私はソリューションに対してPayPalの報酬を提供します。これが条件に反している場合は、この行を削除するだけで、この質問を閉じないでください。

役に立ちましたか?

解決

私は何が悪いのか知っているかもしれませんし、あなたがするためのテストがあります。ユーザーが購入をキャンセルするか、購入を完了した後、購入画面はフィニッシュコールを実行します。何らかの理由で、フィニッシュコールは現在実行中のアクティビティに漂っていました(閉じていますか?

これがログからの関連する行です:

06-16 11:20:22.774:Warn/ActivityManager(132):historyRecord {40ace828 com.android.vending/.billing.inappbuypageactivity}の複製フィニッシュ要求{

コードの問題でこれを修正したことは、自分がやったことを正確に思い出せないということだと思います(購入の完全なハンドラーでフィニッシュを呼び出しなかったかもしれません...)

Andgenについては何も知りませんが、メインアンドゲンアクティビティでフィニッシュコールが呼び出された場合はどうなりますか?実行が停止し、黒い画面とアプリがクラッシュする可能性があると思います。

これをテストするには、ページを購入するための個別のアクティビティを作成します。複雑である必要はありません - 開始後に1つの缶詰製品を購入するだけかもしれません。コードを実行して、それがまだ運命の黒い画面を提供するかどうかを確認してください。私の賭け:それはあなたのゲームに戻ってアクティビティを終了するかもしれませんが、私はそれがうまくいくと思います。

これが助けてくれて幸運を祈ります!

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top