android billing library

This commit is contained in:
Sergey Solovyev 2012-01-21 20:54:48 +04:00
parent af6477e92a
commit c47cccf04a
5 changed files with 21 additions and 10 deletions

View File

@ -99,11 +99,11 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>android-billing-library</groupId> <groupId>org.solovyev.android</groupId>
<artifactId>android-billing-library</artifactId> <artifactId>billing</artifactId>
<version>0.1</version> <version>0.1</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${additionalLibs}/AndroidBillingLibrary.jar</systemPath> <systemPath>${additionalLibs}/android_billing.jar</systemPath>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -7,9 +7,9 @@
package org.solovyev.android.calculator; package org.solovyev.android.calculator;
import android.app.Activity; import android.app.Activity;
import net.robotmedia.billing.BillingRequest;
import net.robotmedia.billing.helper.AbstractBillingObserver; import net.robotmedia.billing.helper.AbstractBillingObserver;
import net.robotmedia.billing.model.Transaction; import net.robotmedia.billing.model.Transaction;
import net.robotmedia.billing.requests.ResponseCode;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
@ -29,12 +29,17 @@ public class CalculatorBillingObserver extends AbstractBillingObserver {
} }
@Override @Override
public void onPurchaseStateChanged(String itemId, Transaction.PurchaseState state) { public void onPurchaseIntentFailure(@NotNull String s, @NotNull ResponseCode responseCode) {
// do nothing // do nothing
} }
@Override @Override
public void onRequestPurchaseResponse(String itemId, BillingRequest.ResponseCode response) { public void onPurchaseStateChanged(@NotNull String itemId, @NotNull Transaction.PurchaseState state) {
// do nothing
}
@Override
public void onRequestPurchaseResponse(@NotNull String itemId, @NotNull ResponseCode response) {
// do nothing // do nothing
} }
} }

View File

@ -14,9 +14,10 @@ import android.preference.PreferenceActivity;
import android.util.Log; import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
import net.robotmedia.billing.BillingController; import net.robotmedia.billing.BillingController;
import net.robotmedia.billing.BillingRequest;
import net.robotmedia.billing.IBillingObserver; import net.robotmedia.billing.IBillingObserver;
import net.robotmedia.billing.model.Transaction; import net.robotmedia.billing.model.Transaction;
import net.robotmedia.billing.requests.ResponseCode;
import org.jetbrains.annotations.NotNull;
import org.solovyev.android.AndroidUtils; import org.solovyev.android.AndroidUtils;
import org.solovyev.android.ads.AdsController; import org.solovyev.android.ads.AdsController;
import org.solovyev.android.calculator.model.CalculatorEngine; import org.solovyev.android.calculator.model.CalculatorEngine;
@ -130,12 +131,17 @@ public class CalculatorPreferencesActivity extends PreferenceActivity implements
} }
@Override @Override
public void onPurchaseIntent(String itemId, PendingIntent purchaseIntent) { public void onPurchaseIntent(@NotNull String itemId, @NotNull PendingIntent purchaseIntent) {
// do nothing // do nothing
} }
@Override @Override
public void onPurchaseStateChanged(String itemId, Transaction.PurchaseState state) { public void onPurchaseIntentFailure(@NotNull String s, @NotNull ResponseCode responseCode) {
// do nothing
}
@Override
public void onPurchaseStateChanged(@NotNull String itemId, @NotNull Transaction.PurchaseState state) {
if (CalculatorApplication.AD_FREE_PRODUCT_ID.equals(itemId)) { if (CalculatorApplication.AD_FREE_PRODUCT_ID.equals(itemId)) {
final Preference adFreePreference = findPreference(CalculatorApplication.AD_FREE_P_KEY); final Preference adFreePreference = findPreference(CalculatorApplication.AD_FREE_P_KEY);
if (adFreePreference != null) { if (adFreePreference != null) {
@ -158,7 +164,7 @@ public class CalculatorPreferencesActivity extends PreferenceActivity implements
} }
@Override @Override
public void onRequestPurchaseResponse(String itemId, BillingRequest.ResponseCode response) { public void onRequestPurchaseResponse(@NotNull String itemId, @NotNull ResponseCode response) {
// do nothing // do nothing
} }

Binary file not shown.