私はアプリ内課金をテストしていましたが、すべてうまくいきました。現在、購入リクエストを送信すると「購入ウィンドウ」が表示され、「今すぐ購入」をクリックすると、GET_PURCHASE_INFORMATION から RESULT_ERROR 応答コードが送信されます:/ トランザクションを復元しようとしても失敗します。
問題が私の問題なのかGoogleの問題なのかを知る方法はありますか? そして、それは何ですか^^(私はグーグルのコードコードを取り、次のクラスを実装しただけです)
private class ThemePurchaseObserver extends PurchaseObserver {
public ThemePurchaseObserver(Handler handler) {
super(PageAccueilActivity.this, handler);
}
@Override
public void onBillingSupported(boolean supported) {
Log.d("ThemePurchaseObserver", "onBillingSupported: "+supported);
if (supported){
SharedPreferences prefs = getSharedPreferences(Utils.getPrefFile(), MODE_PRIVATE);
boolean restorationDone = prefs.getBoolean(KEY_PREF_RESTORATION_DONE, false);
if (!restorationDone){
mBillingService.restoreTransactions();
}
}
}
@Override
public void onPurchaseStateChange(PurchaseState purchaseState,String itemId, int quantity, long purchaseTime,String developerPayload) {
Log.d("ThemePurchaseObserver", "onPurchaseStateChange()");
if (purchaseState == PurchaseState.PURCHASED){
Log.d("ThemePurchaseObserver", itemId+ "PURCHASED");
} else if (purchaseState == PurchaseState.REFUNDED){
Log.d("ThemePurchaseObserver", itemId+ "REFUNDED");
} else if (purchaseState == PurchaseState.CANCELED){
Log.d("ThemePurchaseObserver", itemId+ "CANCELED");
} else {
Log.d("ThemePurchaseObserver", itemId+ " unknow state");
}
}
@Override
public void onRequestPurchaseResponse(RequestPurchase request, ResponseCode responseCode) {
Log.d("ThemePurchaseObserver", "onRequestPurchaseResponse: "+responseCode);
}
@Override
public void onRestoreTransactionsResponse(RestoreTransactions request, ResponseCode responseCode) {
Log.d("ThemePurchaseObserver", "onRestoreTransactionsResponse: "+responseCode);
if (responseCode == ResponseCode.RESULT_OK){
SharedPreferences prefs = getSharedPreferences(Utils.getPrefFile(), MODE_PRIVATE);
Editor editeur = prefs.edit();
editeur.putBoolean(KEY_PREF_RESTORATION_DONE, true);
editeur.commit();
} else {
}
}
}
そして、復元用の logcat があります。
DEBUG/BillingService(3363): Billing service connected
DEBUG/BillingService(3363): CheckBillingSupported
INFO/BillingService(3363): CheckBillingSupported response code: RESULT_OK
DEBUG/ThemePurchaseObserver(3363): onBillingSupported: true
DEBUG/BillingService(3363): RestoreTransactions
ERROR/BillingService(3363): restoreTransactions received RESULT_OK
DEBUG/BillingService(3363): request id: 8836359618243990524
DEBUG/BillingService(3363): request id: -1
INFO/BillingService(3363): handleCommand() action:com.android.vending.billing.RESPONSE_CODE
DEBUG/BillingService(3363): RestoreTransactions: RESULT_ERROR
DEBUG/ThemePurchaseObserver(3363): onRestoreTransactionsResponse: RESULT_ERROR
静的購入の logcat (「android.test.purchase」):
DEBUG/BillingService(3363): RequestPurchase
DEBUG/BillingService(3363): request id: 8990314669027459189
INFO/BillingReceiver(3363): notifyId: android.test.purchased
INFO/BillingService(3363): handleCommand() action: com.example.dungeons.GET_PURCHASE_INFORMATION
DEBUG/BillingService(3363): GetPurchaseInformation
DEBUG/BillingService(3363): request id: 7301564145243038858
DEBUG/BillingService(3363): RequestPurchase: RESULT_OK
DEBUG/ThemePurchaseObserver(3363): onRequestPurchaseResponse: RESULT_OK
INFO/BillingService(3363): handleCommand() action: com.android.vending.billing.RESPONSE_CODE
DEBUG/BillingService(3363): GetPurchaseInformation: RESULT_ERROR
電話の別のGoogleアカウントを使用しようとしました(工場出荷時の設定にリセットした後)が、サポートされているかどうかを確認すると、RESULT_BILLING_UNAVAILABLEが表示されます...