In app purchase

This commit is contained in:
serso 2012-10-10 13:09:35 +04:00
parent 577fac76f8
commit ce2507e28e
3 changed files with 211 additions and 250 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionCode="87" android:versionName="1.3.2" package="org.solovyev.android.calculator">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionCode="89" android:versionName="1.3.2" package="org.solovyev.android.calculator">
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.INTERNET"/>

View File

@ -6,6 +6,7 @@ import android.content.SharedPreferences;
import android.net.Uri;
import android.preference.PreferenceManager;
import net.robotmedia.billing.BillingController;
import net.robotmedia.billing.helper.DefaultBillingObserver;
import org.acra.ACRA;
import org.acra.ReportingInteractionMode;
import org.acra.annotation.ReportsCrashes;
@ -101,10 +102,15 @@ public class CalculatorApplication extends android.app.Application {
}
});
BillingController.registerObserver(new CalculatorBillingObserver(this));
BillingController.registerObserver(new DefaultBillingObserver(this, null));
// init billing controller
BillingController.checkBillingSupported(this);
new Thread(new Runnable() {
@Override
public void run() {
BillingController.checkBillingSupported(CalculatorApplication.this);
}
}).start();
}
private void setTheme(@NotNull SharedPreferences preferences) {

View File

@ -1,45 +0,0 @@
/*
* Copyright (c) 2009-2012. Created by serso aka se.solovyev.
* For more information, please, contact se.solovyev@gmail.com
* or visit http://se.solovyev.org
*/
package org.solovyev.android.calculator;
import android.content.Context;
import net.robotmedia.billing.ResponseCode;
import net.robotmedia.billing.helper.AbstractBillingObserver;
import net.robotmedia.billing.model.Transaction;
import org.jetbrains.annotations.NotNull;
/**
* User: serso
* Date: 1/5/12
* Time: 4:51 PM
*/
public class CalculatorBillingObserver extends AbstractBillingObserver {
public CalculatorBillingObserver(@NotNull Context context) {
super(context);
}
@Override
public void onCheckBillingSupportedResponse(boolean supported) {
// do nothing
}
@Override
public void onPurchaseIntentFailure(@NotNull String s, @NotNull ResponseCode responseCode) {
// do nothing
}
@Override
public void onPurchaseStateChanged(@NotNull String itemId, @NotNull Transaction.PurchaseState state) {
// do nothing
}
@Override
public void onRequestPurchaseResponse(@NotNull String itemId, @NotNull ResponseCode response) {
// do nothing
}
}