私はこれを数日間修正しようとしていましたが、ここでは私がトラブルシューティングを行い、 LogCatのエラーメッセージ。私はAndengineを使用してAndroidのゲームを開発しています(これは問題の一部かもしれないので、それに慣れていると助けになるかもしれません)。私はあまりにも幻想的なことはしていません、私のゲームの活動はすべて単一のシーンであり、物理学やそのような何も、スプライトやテクスチャの束を持っていません。私はそれがグラフィカルに魅力的なスクリーンをセットアップする非常に簡単な方法であることがわかったので、私はゲームで他のすべての活動にAndengineを使用しました。そのような画面の1つは、ユーザーがレベルパックと新しいスプライトを購入できる、インアプリストアです。このすべての請求の部分は素晴らしいです、購入は市場に行くとそこに複雑すぎるものはありません。アプリでは、保留中のインテントと切り替えアクティビティで問題が発生しています
ユーザーが購入をクリックすると、マーケット画面がポップアップし、選択した商品がロードされますゲームは公開されていませんが、実際の製品ではなく、アンドロイドのテストです)。マーケットの画面は、ゲームのスタックの一部である「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()メソッドを保持するため、最も重要です。
... startService(new Intent(mContext, BillingService.class));
BillingHelper.setCompletedHandler(mTransactionHandler);
:
BillingHelper.requestPurchase(StoreFront.this, itemID);
と、私はこのようなものを(ぇでやるように言われたように)持って店頭ののonCreateで:私はこのような私の店頭活動からの要求の購入を呼び出します
//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
私は、このような他の場所StoreFront.this、getApplicationContext()、静的コンテクストストア、保存された静的な活動として「ActivityContext」などの引数の様々な店先から呼び出す試してみました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());
}
}
の関連する部分はあります他の場所で、getBaseContext()何も私はここで
が他の関連する活動の空想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");
}
}
何もあり...の可能性考えることが、私は、ユーザーが、好ましくは、(私の様々な活動のいずれかに戻すことがしたいですStoreFront )彼らはいずれかのアイテムを購入するか、プロセス中に戻るを押します。助けてください!
編集:購入が完了した後でもアプリ内課金をアプリに返すことを可能にする解決策が必要です。
EDIT
何の問題のlogcatとメソッドを呼び出します:私は実際にものを買うことができます別の電話(私が働いている別の開発者、でこれをテストしている
"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ライブラリによって期待されるので、赤いニシンです。
また、(私はこれがここで許可されることを望みます)私は解決策のためにペンパルの報酬を提供します。したがって、この条項に違反している場合は、この行を削除してください。この質問を終了しないでください。
あなたのハンドラから「取引完了」と「購入したアイテムはありますか?」というメッセージが表示されますか?すなわち、呼び出されているハンドラは – Blundell
です。いいえ、私は実際にはそうではありません。それは私の商人のアカウントに表示されますが、私はLogCatでそれを見ていないので、購入は間違いなく通過し、請求されています。これはあなたが問題が何であるかを知っていることを意味しますか?そうすれば私の個人的な救い主になるでしょう。 –
あなたはあなたのLogCatから何を出ていますか、InAppのtutはたくさんのログアウトを持っていますので、あなたのlogcatはどこで停止したのかを示すことができます。 BillingHelper.javaのverifyPurchase(文字列、文字列)メソッドを見てください。これはおそらくあなたの電話番号が – Blundell