Android In-app Billing Restore_transaction Usage
Is there any example available on how to use RESTORE_TRANSACTIONS request to restore an In-app product purchase information? I came up with this code, but it always returns 0, so i
Solution 1:
I used this method:
publicstaticvoidrestoreTransactionInformation(Long nonce)
{
if (amIDead())
{
return;
}
Log.i(TAG, "confirmTransaction()");
Bundlerequest= makeRequestBundle("RESTORE_TRANSACTIONS");
// The REQUEST_NONCE key contains a cryptographically secure nonce (number used once) that you must generate
request.putLong("NONCE", nonce);
try
{
Bundleresponse= mService.sendBillingRequest(request);
//The REQUEST_ID key provides you with a unique request identifier for the requestLongrequestIndentifier= (Long) response.get("REQUEST_ID");
Log.i(TAG, "current request is:" + requestIndentifier);
//The RESPONSE_CODE key provides you with the status of the requestIntegerresponseCodeIndex= (Integer) response.get("RESPONSE_CODE");
C.ResponseCoderesponseCode= C.ResponseCode.valueOf(responseCodeIndex);
Log.i(TAG, "RESTORE_TRANSACTIONS Sync Response code: "+responseCode.toString());
}
catch (RemoteException e)
{
Log.e(TAG, "Failed, internet error maybe", e);
Log.e(TAG, "Billing supported: " + isBillingSupported());
}
}
, The call is as follows:
BillingHelper.restoreTransactionInformation(BillingSecurity.generateNonce());
Post a Comment for "Android In-app Billing Restore_transaction Usage"