Coder Social home page Coder Social logo

johnspeny / cocos2d-android-iap-sample-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pushon/cocos2d-android-iap-sample

0.0 0.0 0.0 3.05 MB

Sample of cocos2d-x In-App-Purchase for Android

License: MIT License

C++ 69.45% Java 24.62% Makefile 0.80% CMake 5.13%

cocos2d-android-iap-sample-1's Introduction

Overview

This is sample of cocos2d-x In-App-Purchase for android.

  • support Billing Library Version 4
  • cocos2d-x v3

The interface is similar to sdkbox::IAP with a few differences. It does not have all the features of sdkbox::IAP. However, you can retrieve a list of products, send purchase requests, and receive the results.

You are free to modify all sources in Java and C++. Add or modify the functionality you need.

Usage

step1.

git clone https://github.com/mingos/cocos2d-android-iap-sample

step2.

Place the cocos2d folder directly under your project.

step3.

Overwrite Resources/sdkbox_config.json with the files used in your project.

step4.

Put the correct information in the following line in proj.android/gradle.properties. This is required for the purchase test to work properly.

RELEASE_STORE_FILE=
RELEASE_STORE_PASSWORD=
RELEASE_KEY_PASSWORD=
RELEASE_KEY_ALIAS=

step5.

Correct the package name in the following file to the package name of your project. In the sample, it says "your package name", but of course it will not work as it is.

  • proj.android/app/AndroidManifest.xml (line:3)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="your package name"
    android:installLocation="auto">
  • proj.android/app/build.gradle (line:8)
apply plugin: 'com.android.application'

android {
    compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
    buildToolsVersion '33.0.0'

    defaultConfig {
        applicationId "your package name"
        minSdkVersion PROP_MIN_SDK_VERSION
        targetSdkVersion PROP_TARGET_SDK_VERSION
        versionCode 1
        versionName "1.0.0"        

step6.

Start Android Studio and open the proj.android directory.

About the work for release builds

Remember to add these lines to proguard-rules.pro. Forgetting to do this will cause the app to crash in the release build.

  • proj.android/app/proguard-rules.pro
-keep class iap.** { *; }
-dontwarn iap.**

Author

mingos

cocos2d-android-iap-sample-1's People

Contributors

mingos avatar otk2038 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.