Code Monkey home page Code Monkey logo

pay-me's Introduction

pay-me

Build Status

the place burned down? lightning struck? slow business?

An Android library for handling In-App-Billing V3 (IABv3), based on Google's marketbilling sample code. The goal of this project is to build a reliable and tested library which can easily be included as an apklib in your (Maven based) projects.

Google's sample code has been refactored and made testable - at the moment there are over 100 unit tests covering most of the code base. It is currently used in the 1.5.x version of SMS Backup+.

usage

Install the apklib to your local maven repository (it has not been published yet).

$ git clone https://github.com/jberkel/pay-me.git
$ cd pay-me && mvn install

Add a maven dependency in your main project:

<dependency>
    <groupId>com.github.jberkel.pay.me</groupId>
    <artifactId>library</artifactId>
    <version>0.0.3</version>
    <type>apklib</type>
</dependency>

Instantiate and use the IabHelper in your activity:

@Override public void onCreate(Bundle bundle) {
    mIabHelper = new IabHelper(this, "Base64EncodedPublicKey");
    mIabHelper.startSetup(new OnIabSetupFinishedListener() {
        public void onIabSetupFinished(IabResult result) {
          if (result.isSuccess()) {
              // helper is ready to use
              mIabHelper.launchPurchaseFlow(this,
                 "android.test.purchased",
                  ItemType.IN_APP,
                  0,
                  new OnIabPurchaseFinishedListener() {
                     public void onIabPurchaseFinished(IabResult result, Purchase purchase) {
                        // handle purchase result
                     }
                  }, null
              );
          }
        }
    });
}

@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    mIabHelper.handleActivityResult(requestCode, resultCode, data);
}

##License

This application is released under the terms of the Apache License, Version 2.0.

pay-me's People

Contributors

jberkel avatar tomtasche avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.