简体   繁体   中英

In-App Billing RESTORE_TRANSACTION give DEVELOPER_ERROR

i'm implementing in-app billing in my app. I just implemented REQUEST_PURCHASE, CONFIRM_NOTIFICATION and CHECK_BILLING, and they works fine.

Now i'm trying to implement REQUEST_TRANSACTIONS method, but i have a problem, once i sent the request with sendBIllingRequest, i receive a RESPONSE_CODE response with RESULT_DEVELOPER_ERROR (5).

This is how i make the request:

    Log.d(TAG, "Action equals RESTORE_TRANSACTIONS");
Bundle request = makeRequestBundle("RESTORE_TRANSACTIONS");
request.putLong("NONCE", BillingSecurity.newNonce());
try {
    Bundle response = mService.sendBillingRequest(request);
    int response_code = response.getInt("RESPONSE_CODE", -1);
    Log.d(TAG, "RESPONSE Restore: " + response_code);
    restored=true;
} catch (RemoteException e) {
    e.printStackTrace();
}

I read on other questions, that RESTORE_TRANSACTIONS need to be launched when debug mode is disabled. I disabled it from The Manifest (i cleared the field, because if i put false LogCat didn't show any debug print), so this is my Android Manifest:

<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="resistorcalc.main"
  android:versionName="3.0" android:versionCode="9">
<uses-sdk android:minSdkVersion="8"></uses-sdk>

<uses-permission android:name="com.android.vending.BILLING" />

<application android:label="@string/app_name" android:name=".App" android:icon="@drawable/resistoricon">
    <activity android:name=".launchActivity"
              android:label="@string/app_name" android:screenOrientation="portrait" android:clearTaskOnLaunch="true" android:finishOnTaskLaunch="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:launchMode="standard" android:label="@string/app_name" android:name="SupportusActivity" android:finishOnTaskLaunch="true" android:clearTaskOnLaunch="true" android:screenOrientation="portrait"></activity>
    <activity android:launchMode="standard" android:label="@string/app_name" android:name="OhmLawActivity" android:finishOnTaskLaunch="true" android:clearTaskOnLaunch="true" android:screenOrientation="portrait"></activity>
    <activity android:launchMode="standard" android:label="@string/app_name" android:name="ResistorSumActivity" android:finishOnTaskLaunch="true" android:clearTaskOnLaunch="true" android:screenOrientation="portrait"></activity>               
    <activity android:name="com.google.ads.AdActivity"
          android:configChanges="keyboard|keyboardHidden|orientation" android:clearTaskOnLaunch="true" android:finishOnTaskLaunch="true"/>
    <service android:name=".billing.BillingService" />

    <receiver android:name=".billing.BillingReceiver">
        <intent-filter>
            <action android:name="com.android.vending.billing.IN_APP_NOTIFY" />
            <action android:name="com.android.vending.billing.RESPONSE_CODE" />
            <action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED" />
        </intent-filter>
    </receiver>               
</application>

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Now my questions are:

  1. I need to put false on Debuggable flag on the manifest? Or i just need to run the application.
  2. Why logcat doesn't show any Log.* message if debuggable is se to false? It is a normal Behaviour (i'm using logcat inside eclipse)
  3. If i use the static requests like android.test.purchased, they can be retrieved using RESTOrE_TRANSACTIONS?
  4. Do i need to upload the draft on my market in order to have that method working?

Thanks, Ivan

The debug flag in the manifest has nothing to do with this. You need to sign your app with you release key and upload a draft to the Play Store. You might have to wait for an hour or so for it to get activated too. And no, RESTORE_TRANSACTIONS does not work with the test items, you need to use your own published item. All of this is described in the reference , you shouldn't have any problems if you follow it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM