├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── drawable-xxhdpi │ │ │ │ └── ic_prompt.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── drawable-v21 │ │ │ │ └── fw_ripple.xml │ │ │ ├── drawable │ │ │ │ ├── fw_ripple.xml │ │ │ │ └── ic_launcher_background.xml │ │ │ ├── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ └── layout │ │ │ │ ├── next_activity_layout.xml │ │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── tjbaobao │ │ │ └── gitee │ │ │ └── googlebillingutil │ │ │ ├── NextActivity.kt │ │ │ └── MainActivity.kt │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── tjbaobao │ │ │ └── gitee │ │ │ └── googlebillingutil │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── tjbaobao │ │ └── gitee │ │ └── googlebillingutil │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── billing ├── .gitignore ├── consumer-rules.pro ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── tjbaobao │ │ │ └── gitee │ │ │ └── billing │ │ │ ├── PackInfo.java │ │ │ └── OnGoogleBillingListener.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── tjbaobao │ │ │ └── gitee │ │ │ └── billing │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── tjbaobao │ │ └── gitee │ │ └── billing │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── doc ├── package-list ├── script.js ├── allclasses-noframe.html ├── allclasses-frame.html ├── com │ └── tjbaobao │ │ └── gitee │ │ └── billing │ │ ├── package-frame.html │ │ ├── package-tree.html │ │ ├── PackInfo.html │ │ ├── package-summary.html │ │ └── GoogleBillingUtilOld.OnConsumeResponseListener.html ├── index.html ├── deprecated-list.html ├── index-files │ ├── index-13.html │ ├── index-12.html │ ├── index-1.html │ ├── index-10.html │ ├── index-14.html │ ├── index-6.html │ ├── index-2.html │ ├── index-4.html │ ├── index-8.html │ ├── index-3.html │ └── index-11.html ├── help-doc.html ├── constant-values.html └── overview-tree.html ├── settings.gradle ├── images ├── home.webp └── purchase.webp ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .idea ├── markdown-navigator │ └── profiles_settings.xml ├── codeStyles │ ├── codeStyleConfig.xml │ └── Project.xml ├── vcs.xml ├── compiler.xml ├── misc.xml ├── gradle.xml ├── jarRepositories.xml └── markdown-navigator.xml ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── gradlew └── README.md /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /billing/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /doc/package-list: -------------------------------------------------------------------------------- 1 | com.tjbaobao.gitee.billing 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':billing' 2 | -------------------------------------------------------------------------------- /billing/consumer-rules.pro: -------------------------------------------------------------------------------- 1 | -keep class com.tjbaobao.gitee.billing.**{*;} -------------------------------------------------------------------------------- /images/home.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TJHello/GoogleBilling/HEAD/images/home.webp -------------------------------------------------------------------------------- /images/purchase.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TJHello/GoogleBilling/HEAD/images/purchase.webp -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TJHello/GoogleBilling/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /billing/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | GoogleBilling 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TJHello/GoogleBilling/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TJHello/GoogleBilling/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TJHello/GoogleBilling/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_prompt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TJHello/GoogleBilling/HEAD/app/src/main/res/drawable-xxhdpi/ic_prompt.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TJHello/GoogleBilling/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TJHello/GoogleBilling/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.idea/markdown-navigator/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TJHello/GoogleBilling/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TJHello/GoogleBilling/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TJHello/GoogleBilling/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TJHello/GoogleBilling/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TJHello/GoogleBilling/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /billing/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | GoogleBilling 3 | 清除 4 | 5 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /billing/src/main/java/com/tjbaobao/gitee/billing/PackInfo.java: -------------------------------------------------------------------------------- 1 | package com.tjbaobao.gitee.billing; 2 | 3 | /** 4 | * 作者:TJbaobao 5 | * 时间:2019/1/5 14:41 6 | * 说明: 7 | * 使用: 8 | */ 9 | public class PackInfo { 10 | } 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches/build_file_checksums.ser 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | .DS_Store 9 | /build 10 | /captures 11 | .externalNativeBuild 12 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Mar 29 10:36:52 CST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | @color/app_color 5 | #D81B60 6 | #0096ff 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/fw_ripple.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/com/tjbaobao/gitee/googlebillingutil/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.tjbaobao.gitee.googlebillingutil 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /billing/src/test/java/com/tjbaobao/gitee/billing/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.tjbaobao.gitee.billing; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/fw_ripple.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 18 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/tjbaobao/gitee/googlebillingutil/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.tjbaobao.gitee.googlebillingutil 2 | 3 | import android.support.test.InstrumentationRegistry 4 | import android.support.test.runner.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getTargetContext() 22 | assertEquals("com.tjbaobao.gitee.googlebillingutil", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /billing/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 20 | 21 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # Kotlin code style for this project: "official" or "obsolete": 15 | kotlin.code.style=official 16 | -------------------------------------------------------------------------------- /billing/src/androidTest/java/com/tjbaobao/gitee/billing/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.tjbaobao.gitee.billing; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.tjbaobao.gitee.billing.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /doc/script.js: -------------------------------------------------------------------------------- 1 | function show(type) 2 | { 3 | count = 0; 4 | for (var key in methods) { 5 | var row = document.getElementById(key); 6 | if ((methods[key] & type) != 0) { 7 | row.style.display = ''; 8 | row.className = (count++ % 2) ? rowColor : altColor; 9 | } 10 | else 11 | row.style.display = 'none'; 12 | } 13 | updateTabs(type); 14 | } 15 | 16 | function updateTabs(type) 17 | { 18 | for (var value in tabs) { 19 | var sNode = document.getElementById(tabs[value][0]); 20 | var spanNode = sNode.firstChild; 21 | if (value == type) { 22 | sNode.className = activeTableTab; 23 | spanNode.innerHTML = tabs[value][1]; 24 | } 25 | else { 26 | sNode.className = tableTab; 27 | spanNode.innerHTML = "" + tabs[value][1] + ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 11 | 14 | 15 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | apply plugin: 'kotlin-android' 4 | 5 | apply plugin: 'kotlin-android-extensions' 6 | 7 | 8 | android { 9 | 10 | compileSdkVersion 28 11 | defaultConfig { 12 | applicationId "com.diamond.art.color.by.number"//原包名 com.tjbaobao.gitee.googlebillingutil 13 | minSdkVersion 16 14 | targetSdkVersion 28 15 | versionCode 20//1.0.1 16 | versionName "1.20"//1.0.1 17 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 18 | } 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | 26 | compileOptions { 27 | sourceCompatibility JavaVersion.VERSION_1_8 28 | targetCompatibility JavaVersion.VERSION_1_8 29 | } 30 | } 31 | 32 | dependencies { 33 | implementation fileTree(dir: 'libs', include: ['*.jar']) 34 | implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 35 | implementation 'com.android.support:appcompat-v7:28.0.0' 36 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 37 | testImplementation 'junit:junit:4.12' 38 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 39 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 40 | // implementation 'com.gitee.tjbaobao:GoogleBilling:1.2.1-alpha04' 41 | 42 | implementation project(':billing') 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /billing/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.github.dcendents.android-maven' 3 | apply plugin: 'maven' 4 | 5 | ext.ver = '1.2.2.13' 6 | ext.verCode = 122213 7 | ext.GROUP_ID = 'com.TJHello' 8 | ext.POM_ARTIFACT_ID = 'GoogleBilling' 9 | 10 | android { 11 | compileSdkVersion 28 12 | 13 | defaultConfig { 14 | minSdkVersion 16 15 | targetSdkVersion 28 16 | versionCode verCode 17 | versionName "${ver}" 18 | 19 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 20 | consumerProguardFiles 'consumer-rules.pro' 21 | 22 | } 23 | 24 | buildTypes { 25 | release { 26 | minifyEnabled false 27 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 28 | } 29 | } 30 | 31 | compileOptions { 32 | sourceCompatibility JavaVersion.VERSION_1_8 33 | targetCompatibility JavaVersion.VERSION_1_8 34 | } 35 | } 36 | 37 | dependencies { 38 | implementation fileTree(dir: 'libs', include: ['*.jar']) 39 | implementation 'com.android.support:appcompat-v7:28.0.0' 40 | testImplementation 'junit:junit:4.12' 41 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 42 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 43 | 44 | //内购 45 | api 'com.android.billingclient:billing:1.2.2' 46 | } 47 | 48 | task sourcesJar(type: Jar) { 49 | classifier = 'sources' 50 | from android.sourceSets.main.java.sourceFiles 51 | } 52 | 53 | artifacts { 54 | archives sourcesJar 55 | } 56 | 57 | tasks.withType(Javadoc) { 58 | options.addStringOption('Xdoclint:none', '-quiet') 59 | options.addStringOption('encoding', 'UTF-8') 60 | options.addStringOption('charSet', 'UTF-8') 61 | } 62 | 63 | //uploadArchives { 64 | // repositories { 65 | // mavenDeployer { 66 | // repository(url: uri("C:\\Android\\unityWorkSpace\\ADEasyLib\\repo")) 67 | // pom.groupId = GROUP_ID 68 | // pom.artifactId = POM_ARTIFACT_ID 69 | // pom.version = ver 70 | // } 71 | // } 72 | //} 73 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /doc/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 所有类 8 | 9 | 10 | 11 | 12 | 13 |

所有类

14 |
15 | 28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /doc/allclasses-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 所有类 8 | 9 | 10 | 11 | 12 | 13 |

所有类

14 |
15 | 28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /doc/com/tjbaobao/gitee/billing/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.tjbaobao.gitee.billing 8 | 9 | 10 | 11 | 12 | 13 |

com.tjbaobao.gitee.billing

14 |
15 |

接口

16 | 23 |

24 | 31 |

枚举

32 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /doc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 生成的文档 (无标题) 8 | 61 | 62 | 63 | 64 | 65 | 66 | <noscript> 67 | <div>您的浏览器已禁用 JavaScript。</div> 68 | </noscript> 69 | <h2>框架预警</h2> 70 | <p>请使用框架功能查看此文档。如果看到此消息, 则表明您使用的是不支持框架的 Web 客户机。链接到<a href="com/tjbaobao/gitee/billing/package-summary.html">非框架版本</a>。</p> 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /app/src/main/res/layout/next_activity_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 13 | 23 | 32 | 33 | 42 | 50 | 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/tjbaobao/gitee/googlebillingutil/NextActivity.kt: -------------------------------------------------------------------------------- 1 | package com.tjbaobao.gitee.googlebillingutil 2 | 3 | import android.content.Intent 4 | import android.os.Bundle 5 | import android.support.v7.app.AppCompatActivity 6 | import android.widget.Toast 7 | import com.android.billingclient.api.Purchase 8 | import com.android.billingclient.api.SkuDetails 9 | import com.tjbaobao.gitee.billing.GoogleBillingUtil 10 | import com.tjbaobao.gitee.billing.OnGoogleBillingListener 11 | import kotlinx.android.synthetic.main.next_activity_layout.* 12 | 13 | 14 | /** 15 | * 作者:TJbaobao 16 | * 时间:2019/3/13 11:24 17 | * 说明: 18 | * 使用: 19 | */ 20 | class NextActivity : AppCompatActivity() { 21 | 22 | 23 | private lateinit var googleBillingUtil: GoogleBillingUtil 24 | 25 | companion object { 26 | fun toActivity(activity: AppCompatActivity){ 27 | val intent = Intent(activity,NextActivity::class.java) 28 | activity.startActivity(intent) 29 | } 30 | } 31 | 32 | override fun onCreate(savedInstanceState: Bundle?) { 33 | super.onCreate(savedInstanceState) 34 | setContentView(R.layout.next_activity_layout) 35 | googleBillingUtil = GoogleBillingUtil.getInstance() 36 | .addOnGoogleBillingListener(this, OnMyGoogleBillingListener()) 37 | .build(this) 38 | 39 | //region============================设置按钮点击监听============================ 40 | tvBack.setOnClickListener { 41 | this.finish() 42 | } 43 | btInapp.setOnClickListener { 44 | googleBillingUtil.purchaseInApp(this@NextActivity,googleBillingUtil.getInAppSkuByPosition(0)) 45 | } 46 | btSubs.setOnClickListener { 47 | googleBillingUtil.purchaseSubs(this@NextActivity,googleBillingUtil.getSubsSkuByPosition(0)) 48 | } 49 | //endregion 50 | } 51 | 52 | private inner class OnMyGoogleBillingListener : OnGoogleBillingListener(){ 53 | 54 | override fun onQuerySuccess(skuType: String, list: MutableList,isSelf:Boolean) { 55 | if(skuType==GoogleBillingUtil.BILLING_TYPE_INAPP){ 56 | //内购商品 57 | if(list.size>0){ 58 | btInapp.text = String.format("发起内购:%s",list[0].price) 59 | } 60 | }else if(skuType==GoogleBillingUtil.BILLING_TYPE_SUBS){ 61 | //订阅商品 62 | if(list.size>0){ 63 | btSubs.text = String.format("发起订阅:%s",list[0].price) 64 | } 65 | } 66 | } 67 | 68 | override fun onPurchaseSuccess(purchase: Purchase,isSelf:Boolean) { 69 | val sku = purchase.sku 70 | val skuType = googleBillingUtil.getSkuType(sku) 71 | if(skuType==GoogleBillingUtil.BILLING_TYPE_INAPP){ 72 | Toast.makeText(this@NextActivity,"内购成功:$sku",Toast.LENGTH_LONG).show() 73 | }else if(skuType==GoogleBillingUtil.BILLING_TYPE_SUBS){ 74 | Toast.makeText(this@NextActivity,"订阅成功:$sku",Toast.LENGTH_LONG).show() 75 | } 76 | } 77 | 78 | } 79 | 80 | override fun onDestroy() { 81 | super.onDestroy() 82 | googleBillingUtil.onDestroy(this) 83 | } 84 | 85 | } -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | 34 | 35 | 39 | 40 | 44 | 45 | 49 | 50 | 54 | 55 | 59 | 60 | -------------------------------------------------------------------------------- /billing/src/main/java/com/tjbaobao/gitee/billing/OnGoogleBillingListener.java: -------------------------------------------------------------------------------- 1 | package com.tjbaobao.gitee.billing; 2 | 3 | import android.support.annotation.NonNull; 4 | import com.android.billingclient.api.Purchase; 5 | import com.android.billingclient.api.SkuDetails; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | /** 11 | * 作者:天镜baobao 12 | * 时间:2019/6/2 13:51 13 | * 说明:允许对该封装进行改动,但请注明出处。 14 | * 使用: 15 | * 16 | * Copyright 2019 天镜baobao 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the "License"); 19 | * you may not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * http://www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an "AS IS" BASIS, 26 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | public class OnGoogleBillingListener { 31 | 32 | @SuppressWarnings("WeakerAccess") 33 | public String tag = null; 34 | 35 | /** 36 | * 查询成功 37 | * @param skuType 内购或者订阅 38 | * @param list 商品列表 39 | * @param isSelf 是否是当前页面的结果 40 | */ 41 | public void onQuerySuccess(@NonNull String skuType, @NonNull List list, boolean isSelf){} 42 | 43 | /** 44 | * 购买成功 45 | * @param purchase 商品 46 | * @param isSelf 是否是当前页面的结果 47 | * @param index 在当前列表的序号 48 | * @param size 商品列表的长度 49 | */ 50 | public void onPurchaseSuccess(@NonNull Purchase purchase, boolean isSelf,int index,int size){ 51 | onPurchaseSuccess(purchase,isSelf); 52 | } 53 | 54 | /** 55 | * 购买成功 56 | * @param purchase 商品 57 | * @param isSelf 是否是当前页面的结果 58 | */ 59 | public void onPurchaseSuccess(@NonNull Purchase purchase, boolean isSelf){} 60 | 61 | 62 | /** 63 | * 初始化成功 64 | * @param isSelf 是否是当前页面的结果 65 | */ 66 | public void onSetupSuccess(boolean isSelf){} 67 | 68 | /** 69 | * 链接断开 70 | */ 71 | @SuppressWarnings("WeakerAccess") 72 | public void onBillingServiceDisconnected(){ } 73 | 74 | /** 75 | * 消耗成功 76 | * @param purchaseToken token 77 | * @param isSelf 是否是当前页面的结果 78 | */ 79 | public void onConsumeSuccess(@NonNull String purchaseToken,boolean isSelf){} 80 | 81 | /** 82 | * 失败回调 83 | * @param tag {@link GoogleBillingUtil.GoogleBillingListenerTag} 84 | * @param responseCode 返回码{https://developer.android.com/google/play/billing/billing_reference} 85 | * @param isSelf 是否是当前页面的结果 86 | */ 87 | public void onFail(@NonNull GoogleBillingUtil.GoogleBillingListenerTag tag, int responseCode, boolean isSelf){} 88 | 89 | /** 90 | * google组件初始化失败等等。 91 | * @param tag {@link GoogleBillingUtil.GoogleBillingListenerTag} 92 | * @param isSelf 是否是当前页面的结果 93 | */ 94 | public void onError(@NonNull GoogleBillingUtil.GoogleBillingListenerTag tag, boolean isSelf){} 95 | 96 | /** 97 | * 获取历史订单-无论是否还有效 98 | * @param purchase 商品实体 99 | */ 100 | public void onQueryHistory(@NonNull Purchase purchase){ 101 | 102 | } 103 | 104 | } 105 | -------------------------------------------------------------------------------- /doc/deprecated-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 已过时的列表 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 42 |
43 | 70 | 71 |
72 |

已过时的 API

73 |

目录

74 |
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 91 |
92 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 18 | 28 | 40 | 41 | 49 | 54 | 63 | 73 | 74 | 79 | 88 | 89 | 98 | 99 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 20 | 22 | 23 | 25 | 26 | 27 | 28 |
29 | 30 | 31 | 32 | xmlns:android 33 | 34 | ^$ 35 | 36 | 37 | 38 |
39 |
40 | 41 | 42 | 43 | xmlns:.* 44 | 45 | ^$ 46 | 47 | 48 | BY_NAME 49 | 50 |
51 |
52 | 53 | 54 | 55 | .*:id 56 | 57 | http://schemas.android.com/apk/res/android 58 | 59 | 60 | 61 |
62 |
63 | 64 | 65 | 66 | .*:name 67 | 68 | http://schemas.android.com/apk/res/android 69 | 70 | 71 | 72 |
73 |
74 | 75 | 76 | 77 | name 78 | 79 | ^$ 80 | 81 | 82 | 83 |
84 |
85 | 86 | 87 | 88 | style 89 | 90 | ^$ 91 | 92 | 93 | 94 |
95 |
96 | 97 | 98 | 99 | .* 100 | 101 | ^$ 102 | 103 | 104 | BY_NAME 105 | 106 |
107 |
108 | 109 | 110 | 111 | .* 112 | 113 | http://schemas.android.com/apk/res/android 114 | 115 | 116 | ANDROID_ATTRIBUTE_ORDER 117 | 118 |
119 |
120 | 121 | 122 | 123 | .* 124 | 125 | .* 126 | 127 | 128 | BY_NAME 129 | 130 |
131 |
132 |
133 |
134 | 135 | 137 |
138 |
-------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 32 | 34 | 36 | 38 | 40 | 42 | 44 | 46 | 48 | 50 | 52 | 54 | 56 | 58 | 60 | 62 | 64 | 66 | 68 | 70 | 72 | 74 | 75 | -------------------------------------------------------------------------------- /app/src/main/java/com/tjbaobao/gitee/googlebillingutil/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.tjbaobao.gitee.googlebillingutil 2 | 3 | import android.content.Intent 4 | import android.net.Uri 5 | import android.support.v7.app.AppCompatActivity 6 | import android.os.Bundle 7 | import com.android.billingclient.api.Purchase 8 | import com.android.billingclient.api.SkuDetails 9 | import com.tjbaobao.gitee.billing.GoogleBillingUtil 10 | import com.tjbaobao.gitee.billing.OnGoogleBillingListener 11 | import kotlinx.android.synthetic.main.activity_main.* 12 | import java.text.DateFormat 13 | import java.text.SimpleDateFormat 14 | import java.util.* 15 | 16 | 17 | class MainActivity : AppCompatActivity() { 18 | 19 | private lateinit var googleBillingUtil: GoogleBillingUtil 20 | 21 | private val logBuffer = StringBuffer() 22 | 23 | override fun onCreate(savedInstanceState: Bundle?) { 24 | super.onCreate(savedInstanceState) 25 | setContentView(R.layout.activity_main) 26 | GoogleBillingUtil.isDebug(true) 27 | GoogleBillingUtil.setSkus(arrayOf("tips_level1","tips_level2","tips_level3"), arrayOf("weekly","monthly","yearly")) 28 | // GoogleBillingUtil.setSkus(arrayOf("tips_level1","tips_level2","tips_level3"), null)//如果没有订阅 29 | GoogleBillingUtil.setIsAutoConsumeAsync(false)//在你不完成熟悉自动消耗的逻辑是,建议关闭自动消耗功能,或者改用122-21版本 30 | googleBillingUtil = GoogleBillingUtil.getInstance() 31 | .addOnGoogleBillingListener(this, OnMyGoogleBillingListener()) 32 | .build(this) 33 | 34 | //region============================设置按钮点击监听============================ 35 | 36 | btNext.setOnClickListener { 37 | NextActivity.toActivity(this) 38 | } 39 | tvLogClean.setOnClickListener { 40 | tvLog.text = "" 41 | } 42 | ivHelp.setOnClickListener { 43 | val intent = Intent() 44 | val uri = Uri.parse("https://github.com/TJHello/GoogleBilling") 45 | intent.action = Intent.ACTION_VIEW 46 | intent.data = uri 47 | startActivity(intent) 48 | } 49 | 50 | //endregion 51 | 52 | } 53 | 54 | private inner class OnMyGoogleBillingListener : OnGoogleBillingListener() { 55 | //内购服务初始化成功 56 | override fun onSetupSuccess(isSelf: Boolean) { 57 | log("内购服务初始化完成") 58 | checkSubs() 59 | } 60 | 61 | override fun onQuerySuccess(skuType: String, list: MutableList,isSelf: Boolean) { 62 | if(!isSelf) return 63 | val tempBuffer = StringBuffer() 64 | tempBuffer.append("查询商品信息成功($skuType):\n") 65 | for((i, skuDetails) in list.withIndex()){ 66 | val details = String.format(Locale.getDefault(),"%s , %s", 67 | skuDetails.sku,skuDetails.price 68 | ) 69 | tempBuffer.append(details) 70 | if(i!=list.size-1){ 71 | tempBuffer.append("\n") 72 | } 73 | } 74 | log(tempBuffer.toString()) 75 | } 76 | 77 | override fun onPurchaseSuccess(purchase: Purchase,isSelf: Boolean) { 78 | val tempBuffer = StringBuffer() 79 | val details = String.format(Locale.getDefault(),"购买商品成功:%s", purchase.sku) 80 | tempBuffer.append(details) 81 | log(tempBuffer.toString()) 82 | } 83 | 84 | override fun onConsumeSuccess(purchaseToken: String,isSelf: Boolean) { 85 | log("消耗商品成功:$purchaseToken") 86 | } 87 | 88 | override fun onFail(tag: GoogleBillingUtil.GoogleBillingListenerTag, responseCode: Int,isSelf: Boolean) { 89 | log("操作失败:tag=${tag.name},responseCode=$responseCode") 90 | } 91 | 92 | override fun onError(tag: GoogleBillingUtil.GoogleBillingListenerTag,isSelf: Boolean) { 93 | log("发生错误:tag=${tag.name}") 94 | } 95 | } 96 | 97 | /** 98 | * 检查是否有有效订阅 99 | */ 100 | private fun checkSubs(){ 101 | when(val size = googleBillingUtil.getPurchasesSizeSubs(this)){ 102 | 0->{ 103 | //不具备有效订阅 104 | log("有效订阅数:0(无有效订阅)") 105 | } 106 | -1->{ 107 | //查询失败 108 | log("有效订阅数:-1(查询失败)") 109 | } 110 | else->{ 111 | //具有有效订阅 112 | log("有效订阅数:$size(具备有效订阅)") 113 | } 114 | } 115 | } 116 | 117 | override fun onDestroy() { 118 | super.onDestroy() 119 | googleBillingUtil.onDestroy(this) 120 | //退出程序的时候可以调用(实验性) 121 | GoogleBillingUtil.endConnection() 122 | } 123 | 124 | private fun log(msg:String){ 125 | val log = String.format(Locale.getDefault(),"%s\n%s\n\n",getTime(),msg) 126 | logBuffer.append(log) 127 | tvLog.text = logBuffer.toString() 128 | } 129 | 130 | private fun getTime():String{ 131 | val dt = Date() 132 | val sdf = DateFormat.getInstance() as SimpleDateFormat 133 | sdf.applyPattern("HH:mm:ss.SSS") 134 | return sdf.format(dt) 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /doc/index-files/index-13.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | U - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 42 |
43 | 70 | 71 |
A B C E G I O P Q R S T U V  72 | 73 | 74 |

U

75 |
76 |
useAppContext() - 类 中的方法com.tjbaobao.gitee.billing.ExampleInstrumentedTest
77 |
 
78 |
79 | A B C E G I O P Q R S T U V 
80 | 81 |
82 | 83 | 84 | 85 | 86 | 87 | 88 | 96 |
97 | 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /doc/index-files/index-12.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | T - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 42 |
43 | 70 | 71 |
A B C E G I O P Q R S T U V  72 | 73 | 74 |

T

75 |
76 |
tag - 枚举 中的变量com.tjbaobao.gitee.billing.GoogleBillingUtil.GoogleBillingListenerTag
77 |
 
78 |
79 | A B C E G I O P Q R S T U V 
80 | 81 |
82 | 83 | 84 | 85 | 86 | 87 | 88 | 96 |
97 | 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /.idea/markdown-navigator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 36 | 37 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /doc/index-files/index-1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | A - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 42 |
43 | 70 | 71 |
A B C E G I O P Q R S T U V  72 | 73 | 74 |

A

75 |
76 |
addition_isCorrect() - 类 中的方法com.tjbaobao.gitee.billing.ExampleUnitTest
77 |
 
78 |
addOnGoogleBillingListener(Activity, GoogleBillingUtil.OnGoogleBillingListener) - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtil
79 |
 
80 |
81 | A B C E G I O P Q R S T U V 
82 | 83 |
84 | 85 | 86 | 87 | 88 | 89 | 90 | 98 |
99 | 126 | 127 | 128 | 129 | -------------------------------------------------------------------------------- /doc/index-files/index-10.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | R - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 42 |
43 | 70 | 71 |
A B C E G I O P Q R S T U V  72 | 73 | 74 |

R

75 |
76 |
removeOnGoogleBillingListener(GoogleBillingUtil.OnGoogleBillingListener) - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtil
77 |
 
78 |
removeOnGoogleBillingListener(Activity) - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtil
79 |
 
80 |
81 | A B C E G I O P Q R S T U V 
82 | 83 |
84 | 85 | 86 | 87 | 88 | 89 | 90 | 98 |
99 | 126 | 127 | 128 | 129 | -------------------------------------------------------------------------------- /doc/index-files/index-14.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | V - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 42 |
43 | 70 | 71 |
A B C E G I O P Q R S T U V  72 | 73 | 74 |

V

75 |
76 |
valueOf(String) - 枚举 中的静态方法com.tjbaobao.gitee.billing.GoogleBillingUtil.GoogleBillingListenerTag
77 |
78 |
返回带有指定名称的该类型的枚举常量。
79 |
80 |
values() - 枚举 中的静态方法com.tjbaobao.gitee.billing.GoogleBillingUtil.GoogleBillingListenerTag
81 |
82 |
按照声明该枚举类型的常量的顺序, 返回 83 | 包含这些常量的数组。
84 |
85 |
86 | A B C E G I O P Q R S T U V 
87 | 88 |
89 | 90 | 91 | 92 | 93 | 94 | 95 | 103 |
104 | 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /doc/index-files/index-6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | I - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 42 |
43 | 70 | 71 |
A B C E G I O P Q R S T U V  72 | 73 | 74 |

I

75 |
76 |
isAutoConsumeAsync() - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtilOld
77 |
 
78 |
isDebug(boolean) - 类 中的静态方法com.tjbaobao.gitee.billing.GoogleBillingUtil
79 |
 
80 |
isReady() - 类 中的静态方法com.tjbaobao.gitee.billing.GoogleBillingUtil
81 |
82 |
google内购服务是否已经准备好
83 |
84 |
isReady() - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtilOld
85 |
 
86 |
87 | A B C E G I O P Q R S T U V 
88 | 89 |
90 | 91 | 92 | 93 | 94 | 95 | 96 | 104 |
105 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /doc/help-doc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | API 帮助 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 42 |
43 | 70 | 71 |
72 |

此 API 文档的组织方式

73 |
此 API (应用程序编程接口) 文档包含对应于导航栏中的项目的页面, 如下所述。
74 |
75 |
76 |
    77 |
  • 78 |

    程序包

    79 |

    每个程序包都有一个页面, 其中包含它的类和接口的列表及其概要。此页面可以包含六个类别:

    80 |
      81 |
    • 接口 (斜体)
    • 82 |
    • 83 |
    • 枚举
    • 84 |
    • 异常错误
    • 85 |
    • 错误
    • 86 |
    • 注释类型
    • 87 |
    88 |
  • 89 |
  • 90 |

    类/接口

    91 |

    每个类, 接口, 嵌套类和嵌套接口都有各自的页面。其中每个页面都由三部分 (类/接口说明, 概要表, 以及详细的成员说明) 组成:

    92 |
      93 |
    • 类继承图
    • 94 |
    • 直接子类
    • 95 |
    • 所有已知子接口
    • 96 |
    • 所有已知实现类
    • 97 |
    • 类/接口声明
    • 98 |
    • 类/接口说明
    • 99 |
    100 |
      101 |
    • 嵌套类概要
    • 102 |
    • 字段概要
    • 103 |
    • 构造器概要
    • 104 |
    • 方法概要
    • 105 |
    106 |
      107 |
    • 字段详细资料
    • 108 |
    • 构造器详细资料
    • 109 |
    • 方法详细资料
    • 110 |
    111 |

    每个概要条目都包含该项目的详细说明的第一句。概要条目按字母顺序排列, 而详细说明则按其在源代码中出现的顺序排列。这样保持了程序员所建立的逻辑分组。

    112 |
  • 113 |
  • 114 |

    注释类型

    115 |

    每个注释类型都有各自的页面, 其中包含以下部分:

    116 |
      117 |
    • 注释类型声明
    • 118 |
    • 注释类型说明
    • 119 |
    • 必需元素概要
    • 120 |
    • 可选元素概要
    • 121 |
    • 元素详细资料
    • 122 |
    123 |
  • 124 |
  • 125 |

    枚举

    126 |

    每个枚举都有各自的页面, 其中包含以下部分:

    127 |
      128 |
    • 枚举声明
    • 129 |
    • 枚举说明
    • 130 |
    • 枚举常量概要
    • 131 |
    • 枚举常量详细资料
    • 132 |
    133 |
  • 134 |
  • 135 |

    树 (类分层结构)

    136 |

    对于所有程序包, 有一个类分层结构页面, 以及每个程序包的分层结构。每个分层结构页面都包含类的列表和接口的列表。从java.lang.Object开始, 按继承结构对类进行排列。接口不从java.lang.Object继承。

    137 |
      138 |
    • 查看“概览”页面时, 单击 "树" 将显示所有程序包的分层结构。
    • 139 |
    • 查看特定程序包, 类或接口页面时, 单击 "树" 将仅显示该程序包的分层结构。
    • 140 |
    141 |
  • 142 |
  • 143 |

    已过时的 API

    144 |

    已过时的 API 页面列出了所有已过时的 API。一般由于进行了改进并且通常提供了替代的 API, 所以建议不要使用已过时的 API。在将来的实现过程中, 可能会删除已过时的 API。

    145 |
  • 146 |
  • 147 |

    索引

    148 |

    索引 包含按字母顺序排列的所有类, 接口, 构造器, 方法和字段的列表。

    149 |
  • 150 |
  • 151 |

    上一个/下一个

    152 |

    这些链接使您可以转至下一个或上一个类, 接口, 程序包或相关页面。

    153 |
  • 154 |
  • 155 |

    框架/无框架

    156 |

    这些链接用于显示和隐藏 HTML 框架。所有页面均具有有框架和无框架两种显示方式。

    157 |
  • 158 |
  • 159 |

    所有类

    160 |

    所有类链接显示所有类和接口 (除了非静态嵌套类型)。

    161 |
  • 162 |
  • 163 |

    序列化表格

    164 |

    每个可序列化或可外部化的类都有其序列化字段和方法的说明。此信息对重新实现者有用, 而对使用 API 的开发者则没有什么用处。尽管导航栏中没有链接, 但您可以通过下列方式获取此信息: 转至任何序列化类, 然后单击类说明的 "另请参阅" 部分中的 "序列化表格"。

    165 |
  • 166 |
  • 167 |

    常量字段值

    168 |

    常量字段值页面列出了静态最终字段及其值。

    169 |
  • 170 |
171 | 此帮助文件适用于使用标准 doclet 生成的 API 文档。
172 | 173 |
174 | 175 | 176 | 177 | 178 | 179 | 180 | 188 |
189 | 216 | 217 | 218 | 219 | -------------------------------------------------------------------------------- /doc/constant-values.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 常量字段值 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 42 |
43 | 70 | 71 |
72 |

常量字段值

73 |

目录

74 | 77 |
78 |
79 | 80 | 81 |

com.tjbaobao.*

82 | 136 |
137 | 138 |
139 | 140 | 141 | 142 | 143 | 144 | 145 | 153 |
154 | 181 | 182 | 183 | 184 | -------------------------------------------------------------------------------- /doc/index-files/index-2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | B - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 42 |
43 | 70 | 71 |
A B C E G I O P Q R S T U V  72 | 73 | 74 |

B

75 |
76 |
BILLING_TYPE_INAPP - 类 中的静态变量com.tjbaobao.gitee.billing.GoogleBillingUtil
77 |
 
78 |
BILLING_TYPE_INAPP - 类 中的静态变量com.tjbaobao.gitee.billing.GoogleBillingUtilOld
79 |
 
80 |
BILLING_TYPE_SUBS - 类 中的静态变量com.tjbaobao.gitee.billing.GoogleBillingUtil
81 |
 
82 |
BILLING_TYPE_SUBS - 类 中的静态变量com.tjbaobao.gitee.billing.GoogleBillingUtilOld
83 |
 
84 |
build(Context) - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtil
85 |
86 |
开始建立内购连接
87 |
88 |
build(Context) - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtilOld
89 |
 
90 |
91 | A B C E G I O P Q R S T U V 
92 | 93 |
94 | 95 | 96 | 97 | 98 | 99 | 100 | 108 |
109 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /doc/overview-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 类分层结构 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 42 |
43 | 70 | 71 |
72 |

所有程序包的分层结构

73 | 程序包分层结构: 74 | 77 |
78 |
79 |

类分层结构

80 | 91 |

接口分层结构

92 | 99 |

枚举分层结构

100 |
    101 |
  • java.lang.Object 102 | 109 |
  • 110 |
111 |
112 | 113 |
114 | 115 | 116 | 117 | 118 | 119 | 120 | 128 |
129 | 156 | 157 | 158 | 159 | -------------------------------------------------------------------------------- /doc/index-files/index-4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | E - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 42 |
43 | 70 | 71 |
A B C E G I O P Q R S T U V  72 | 73 | 74 |

E

75 |
76 |
endConnection() - 类 中的静态方法com.tjbaobao.gitee.billing.GoogleBillingUtil
77 |
78 |
断开连接google服务 79 | 注意!!!
80 |
81 |
endConnection() - 类 中的静态方法com.tjbaobao.gitee.billing.GoogleBillingUtilOld
82 |
83 |
断开连接google服务 84 | 注意!!!
85 |
86 |
ExampleInstrumentedTest - com.tjbaobao.gitee.billing中的类
87 |
88 |
Instrumented test, which will execute on an Android device.
89 |
90 |
ExampleInstrumentedTest() - 类 的构造器com.tjbaobao.gitee.billing.ExampleInstrumentedTest
91 |
 
92 |
ExampleUnitTest - com.tjbaobao.gitee.billing中的类
93 |
94 |
Example local unit test, which will execute on the development machine (host).
95 |
96 |
ExampleUnitTest() - 类 的构造器com.tjbaobao.gitee.billing.ExampleUnitTest
97 |
 
98 |
99 | A B C E G I O P Q R S T U V 
100 | 101 |
102 | 103 | 104 | 105 | 106 | 107 | 108 | 116 |
117 | 144 | 145 | 146 | 147 | -------------------------------------------------------------------------------- /doc/index-files/index-8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | P - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 42 |
43 | 70 | 71 |
A B C E G I O P Q R S T U V  72 | 73 | 74 |

P

75 |
76 |
PackInfo - com.tjbaobao.gitee.billing中的类
77 |
78 |
作者:TJbaobao 79 | 时间:2019/1/5 14:41 80 | 说明: 81 | 使用:
82 |
83 |
PackInfo() - 类 的构造器com.tjbaobao.gitee.billing.PackInfo
84 |
 
85 |
purchaseInApp(Activity, String) - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtil
86 |
87 |
发起内购
88 |
89 |
purchaseInApp(Activity, String) - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtilOld
90 |
91 |
发起内购
92 |
93 |
purchaseSubs(Activity, String) - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtil
94 |
95 |
发起订阅
96 |
97 |
purchaseSubs(Activity, String) - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtilOld
98 |
99 |
发起订阅
100 |
101 |
102 | A B C E G I O P Q R S T U V 
103 | 104 |
105 | 106 | 107 | 108 | 109 | 110 | 111 | 119 |
120 | 147 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /doc/com/tjbaobao/gitee/billing/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.tjbaobao.gitee.billing 类分层结构 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 42 |
43 | 70 | 71 |
72 |

程序包com.tjbaobao.gitee.billing的分层结构

73 |
74 |
75 |

类分层结构

76 | 87 |

接口分层结构

88 | 95 |

枚举分层结构

96 |
    97 |
  • java.lang.Object 98 | 105 |
  • 106 |
107 |
108 | 109 |
110 | 111 | 112 | 113 | 114 | 115 | 116 | 124 |
125 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /doc/com/tjbaobao/gitee/billing/PackInfo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | PackInfo 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 42 |
43 | 85 | 86 | 87 |
88 |
com.tjbaobao.gitee.billing
89 |

类 PackInfo

90 |
91 |
92 |
    93 |
  • java.lang.Object
  • 94 |
  • 95 |
      96 |
    • com.tjbaobao.gitee.billing.PackInfo
    • 97 |
    98 |
  • 99 |
100 |
101 |
    102 |
  • 103 |
    104 |
    105 |
    public class PackInfo
    106 | extends java.lang.Object
    107 |
    作者:TJbaobao 108 | 时间:2019/1/5 14:41 109 | 说明: 110 | 使用:
    111 |
  • 112 |
113 |
114 |
115 |
    116 |
  • 117 | 118 |
      119 |
    • 120 | 121 | 122 |

      构造器概要

      123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 |
      构造器 
      构造器和说明
      PackInfo() 
      132 |
    • 133 |
    134 | 135 |
      136 |
    • 137 | 138 | 139 |

      方法概要

      140 |
        141 |
      • 142 | 143 | 144 |

        从类继承的方法 java.lang.Object

        145 | clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • 146 |
      147 |
    • 148 |
    149 |
  • 150 |
151 |
152 |
153 |
    154 |
  • 155 | 156 |
      157 |
    • 158 | 159 | 160 |

      构造器详细资料

      161 | 162 | 163 | 164 |
        165 |
      • 166 |

        PackInfo

        167 |
        public PackInfo()
        168 |
      • 169 |
      170 |
    • 171 |
    172 |
  • 173 |
174 |
175 |
176 | 177 | 178 |
179 | 180 | 181 | 182 | 183 | 184 | 185 | 193 |
194 | 236 | 237 | 238 | 239 | -------------------------------------------------------------------------------- /doc/index-files/index-3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | C - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 42 |
43 | 70 | 71 |
A B C E G I O P Q R S T U V  72 | 73 | 74 |

C

75 |
76 |
cleanListener() - 类 中的静态方法com.tjbaobao.gitee.billing.GoogleBillingUtilOld
77 |
78 |
清除所有监听器,防止内存泄漏 79 | 如果有多个页面使用了支付,需要确保上个页面的cleanListener在下一个页面的GoogleBillingUtil.getInstance()前使用。
80 |
81 |
com.tjbaobao.gitee.billing - 程序包 com.tjbaobao.gitee.billing
82 |
 
83 |
consumeAsync(String) - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtil
84 |
85 |
消耗商品
86 |
87 |
consumeAsync(String) - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtilOld
88 |
89 |
消耗商品
90 |
91 |
consumeAsyncInApp(String...) - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtil
92 |
93 |
消耗内购商品-通过sku数组
94 |
95 |
consumeAsyncInApp(List<String>) - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtil
96 |
97 |
消耗内购商品-通过sku数组
98 |
99 |
consumeAsyncInApp(String...) - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtilOld
100 |
101 |
消耗内购商品-通过sku数组
102 |
103 |
consumeAsyncInApp(List<String>) - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtilOld
104 |
105 |
消耗内购商品-通过sku数组
106 |
107 |
108 | A B C E G I O P Q R S T U V 
109 | 110 |
111 | 112 | 113 | 114 | 115 | 116 | 117 | 125 |
126 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /doc/com/tjbaobao/gitee/billing/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.tjbaobao.gitee.billing 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 42 |
43 | 70 | 71 |
72 |

程序包 com.tjbaobao.gitee.billing

73 |
74 |
75 | 178 |
179 | 180 |
181 | 182 | 183 | 184 | 185 | 186 | 187 | 195 |
196 | 223 | 224 | 225 | 226 | -------------------------------------------------------------------------------- /doc/index-files/index-11.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | S - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 42 |
43 | 70 | 71 |
A B C E G I O P Q R S T U V  72 | 73 | 74 |

S

75 |
76 |
setIsAutoConsumeAsync(boolean) - 类 中的静态方法com.tjbaobao.gitee.billing.GoogleBillingUtil
77 |
78 |
设置是否自动消耗内购商品
79 |
80 |
setIsAutoConsumeAsync(boolean) - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtilOld
81 |
 
82 |
setOnConsumeResponseListener(GoogleBillingUtilOld.OnConsumeResponseListener) - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtilOld
83 |
 
84 |
setOnPurchaseFinishedListener(GoogleBillingUtilOld.OnPurchaseFinishedListener) - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtilOld
85 |
 
86 |
setOnQueryFinishedListener(GoogleBillingUtilOld.OnQueryFinishedListener) - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtilOld
87 |
 
88 |
setOnStartSetupFinishedListener(GoogleBillingUtilOld.OnStartSetupFinishedListener) - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtilOld
89 |
 
90 |
setSkus(String[], String[]) - 类 中的静态方法com.tjbaobao.gitee.billing.GoogleBillingUtil
91 |
92 |
设置skus
93 |
94 |
setSkus(String[], String[]) - 类 中的静态方法com.tjbaobao.gitee.billing.GoogleBillingUtilOld
95 |
96 |
设置skus
97 |
98 |
startConnection() - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtil
99 |
 
100 |
startConnection() - 类 中的方法com.tjbaobao.gitee.billing.GoogleBillingUtilOld
101 |
 
102 |
103 | A B C E G I O P Q R S T U V 
104 | 105 |
106 | 107 | 108 | 109 | 110 | 111 | 112 | 120 |
121 | 148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /doc/com/tjbaobao/gitee/billing/GoogleBillingUtilOld.OnConsumeResponseListener.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | GoogleBillingUtilOld.OnConsumeResponseListener 8 | 9 | 10 | 11 | 12 | 13 | 29 | 32 | 33 |
34 | 35 | 36 | 37 | 38 | 39 | 40 | 48 |
49 | 91 | 92 | 93 |
94 |
com.tjbaobao.gitee.billing
95 |

接口 GoogleBillingUtilOld.OnConsumeResponseListener

96 |
97 |
98 |
99 |
    100 |
  • 101 |
    102 |
    封闭类:
    103 |
    GoogleBillingUtilOld
    104 |
    105 |
    106 |
    107 |
    public static interface GoogleBillingUtilOld.OnConsumeResponseListener
    108 |
    消耗回调监听器
    109 |
  • 110 |
111 |
112 |
113 |
    114 |
  • 115 | 116 | 138 |
  • 139 |
140 |
141 |
142 |
    143 |
  • 144 | 145 |
      146 |
    • 147 | 148 | 149 |

      方法详细资料

      150 | 151 | 152 | 153 |
        154 |
      • 155 |

        onConsumeSuccess

        156 |
        void onConsumeSuccess(java.lang.String purchaseToken)
        157 |
      • 158 |
      159 | 160 | 161 | 162 |
        163 |
      • 164 |

        onConsumeFail

        165 |
        void onConsumeFail(int responseCode)
        166 |
      • 167 |
      168 |
    • 169 |
    170 |
  • 171 |
172 |
173 |
174 | 175 | 176 |
177 | 178 | 179 | 180 | 181 | 182 | 183 | 191 |
192 | 234 | 235 | 236 | 237 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GoogleBilling 1.2.2.13 [![](https://jitpack.io/v/TJHello/GoogleBilling.svg)](https://jitpack.io/#TJHello/GoogleBilling) 2 | 3 | #### 基于com.android.billingclient:billing:1.2.2,对整个支付流程进行封装。 4 | ##### QQ群交流:425219113(计算机语言交流) 5 | 6 | **提醒:从2021年8月2日开始,所有新应用都必须使用Billing Library版本3或更高版本。到2021年11月1日,对现有应用程序的所有更新都必须使用Billing Library版本3或更高版本。** 7 | 8 | ### 如今仅维护BillingEasy版本,请前往使用。 9 | **【[BillingEasy-0.1.2](https://gitee.com/TJHello/BillingEasy)】全新设计的内购聚合,同时支持华为内购与谷歌内购** 10 | 11 | **【[ADEasy](https://blog.csdn.net/u013640004/article/details/105416193)】自荐一款全平台广告聚合SDK自动集成框架** 12 | 13 | **【[DYFStoreKit](https://github.com/dgynfi/DYFStoreKit)】【[DYFStore](https://github.com/dgynfi/DYFStore)】友情链接一款IOS内购封装** 14 | 15 | 16 | 17 | --- 18 | ### =================使用方法================= 19 | - API接入 20 | 21 | ```groovy 22 | //Project 23 | allprojects { 24 | repositories { 25 | ... 26 | maven { url 'https://raw.githubusercontent.com/TJHello/publicLib/master'} 27 | } 28 | } 29 | //app 30 | android { 31 | compileOptions { 32 | sourceCompatibility JavaVersion.VERSION_1_8 33 | targetCompatibility JavaVersion.VERSION_1_8 34 | } 35 | } 36 | dependencies { 37 | implementation 'com.TJHello:GoogleBilling:3.0.0.1-a06' 38 | } 39 | 40 | 41 | ``` 42 | 43 | 44 | - 代码示例 [MainActivity](https://gitee.com/tjbaobao/GoogleBilling/blob/master/app/src/main/java/com/tjbaobao/gitee/googlebillingutil/MainActivity.kt) 45 | 46 | ```kotlin 47 | private lateinit var googleBillingUtil: GoogleBillingUtil 48 | 49 | override fun onCreate(savedInstanceState: Bundle?) { 50 | super.onCreate(savedInstanceState) 51 | setContentView(R.layout.activity_main) 52 | GoogleBillingUtil.isDebug(true) 53 | GoogleBillingUtil.setSkus(arrayOf("inappSku"), arrayOf("subsSku")) 54 | googleBillingUtil = GoogleBillingUtil.getInstance() 55 | .addOnGoogleBillingListener(this,OnGoogleBillingListener()) 56 | .build(this) 57 | } 58 | 59 | /** 60 | * 使用了JAVA8特性,可以选择性实现自己想要的方法。 61 | */ 62 | private inner class OnGoogleBillingListener : GoogleBillingUtil.OnGoogleBillingListener(){ 63 | //内购服务初始化成功 64 | override fun onSetupSuccess() { 65 | 66 | } 67 | } 68 | 69 | override fun onDestroy() { 70 | super.onDestroy() 71 | googleBillingUtil.onDestroy(this) 72 | } 73 | ``` 74 | 75 | - 发起内购或者订阅 76 | 77 | 78 | ```java 79 | public void queryInventoryInApp() //查询内购商品信息列表 80 | public void queryInventorySubs() //查询订阅商品信息列表 81 | public void purchaseInApp(Activity activity,String skuId) //发起内购 82 | public void purchaseSubs(Activity activity,String skuId) //发起订阅 83 | public List queryPurchasesInApp(Activity activity)//获取有效内购订单 84 | public List queryPurchasesSubs(Activity activity)//获取有效订阅订单 85 | public void queryPurchaseHistoryAsyncInApp(Activity activity)//查询历史内购订单 86 | public void queryPurchaseHistoryAsyncSubs(Activity activity)//查询历史订阅订单 87 | ``` 88 | 89 | --- 90 | ### =================响应码汇总([官方地址](https://developer.android.com/google/play/billing/billing_reference))================= 91 | 92 | | 响应代码 | 值 | 说明 | 93 | | ------------------------------------------- | -- | ------------------------------------------------------------------------------------------------------------------------------------ | 94 | | BILLING_RESPONSE_RESULT_OK | 0 | 成功 | 95 | | BILLING_RESPONSE_RESULT_USER_CANCELED | 1 | 用户按上一步或取消对话框 | 96 | | BILLING_RESPONSE_RESULT_SERVICE_UNAVAILABLE | 2 | 网络连接断开 | 97 | | BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE | 3 | 所请求的类型不支持 Billing API 版本(支付环境问题) | 98 | | BILLING_RESPONSE_RESULT_ITEM_UNAVAILABLE | 4 | 请求的商品已不再出售。 | 99 | | BILLING_RESPONSE_RESULT_DEVELOPER_ERROR | 5 | 提供给 API 的参数无效。此错误也可能说明未在 Google Play 中针对应用内购买结算正确签署或设置应用,或者应用在其清单中不具备所需的权限。 | 100 | | BILLING_RESPONSE_RESULT_ERROR | 6 | API 操作期间出现严重错误 | 101 | | BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED | 7 | 未能购买,因为已经拥有此商品 | 102 | | BILLING_RESPONSE_RESULT_ITEM_NOT_OWNED | 8 | 未能消费,因为尚未拥有此商品 103 | 104 | --- 105 | ### =================常见问题================= 106 | 107 | **1. 初始化失败,错误码:3,这是支付环境问题。** 108 | 109 | 有以下可能:用的是模拟器,三件套版本太旧,应用的支付环境没配置(接入谷歌服务,支付权限),vpn地域不支持。 110 | 111 | 解决方法:a.先验证环境。在商店下载一个有内购的应用,看能否进行内购。b.如果别人的能进行内购之后,再次测试你的应用,看是否正常,来确认应用的支付环境是否正常。 112 | 113 | **2. 能够查询价格,但无法购买,提示"商品无法购买"之类。** 114 | 115 | 这是基础配置问题,有以下可能:版本号与线上版本不对应,测试版本却不是测试账号(大概率),签名不对应。 116 | 117 | **3. 能够查询价格,但无法调起支付都没有弹窗,错误码:3,报错:Error:In-app billing error: Null data in IAB activity resul。** 118 | 119 | 原因是没有给Google play商店弹窗权限,国内很多手机都有弹窗权限管理,特别是小米,如果没允许,是不会有任何提示,并且拦截了的。(这个问题在新版的gp商店已经不存在) 120 | 121 | **4. 支付提示成功,但却走onQueryFail回调,并且返回的商品列表为null。** 122 | 123 | 这是因为你调错了方法,记得purchaseInApp是内购的,purchaseSubs是订阅的。查询的时候同理。另外查询的时候报错,很有可能是你setSKUS的时候传了一个空字符串,而不是空数组。 124 | 125 | **5. 查询的时候返回的商品列表长度为0。** 126 | 127 | setSkus的时候将内购sku和订阅sku的参数顺序弄错了,应该是第一个是内购的,第二个参数是订阅的。 128 | 129 | 或者是商品还没有发布成功,需要等待一段时间(很有可能,新发布的商品是无论怎么查询还是购买,谷歌那边都是没有响应的) 130 | 131 | 132 | **6. 我们检测到您的应用使用的是旧版 Google Play Developer API。自 2019 年 12 月 1 日起, 133 | 我们将不再支持此 API 的版本 1 和版本 2。请在该日期之前将您使用的 API 更新到版本 3。请注意,此变动与弃用 AIDL/结算库无关。** 134 | 135 | 升级到com.android.billingclient:billing库,弃用AIDL相关代码。 136 | 137 | 后台也要弃用v3的校验接口。具体见谷歌官方文档。 138 | 139 | 140 | --- 141 | ### =================API说明================= 142 | 143 | 1. 初始化google应用内购买服务 144 | 145 | ```java 146 | //设置内购id和订阅id,用于自动查询等 147 | public static void setSkus(@Nullable String[] inAppSKUS,@Nullable String[] subsSKUS) 148 | 149 | //获取单例,全局通用 150 | public static GoogleBillingUtil getInstance() 151 | 152 | //初始化服务,建立连接,全局通用 153 | public GoogleBillingUtil build 154 | 155 | //建立连接,build中已经包含,用于特殊用户自定义重连机制 156 | public boolean startConnection(Activity activity) 157 | 158 | ``` 159 | 160 | 2. 查询商品 161 | 162 | ``` 163 | //查询内购商品信息(价格等信息) 164 | public void queryInventoryInApp(Activity activity) 165 | 166 | //查询订阅商品信息(价格等信息) 167 | public void queryInventorySubs(Activity activity) 168 | 169 | ``` 170 | 171 | 3. 购买商品 172 | 173 | ``` 174 | 175 | //发起内购 176 | public void purchaseInApp(Activity activity, String skuId) 177 | 178 | //发起订阅 179 | public void purchaseSubs(Activity activity,String skuId) 180 | 181 | ``` 182 | 4. 消耗商品 183 | 184 | ``` 185 | //消耗商品,通过purchaseToken 186 | public void consumeAsync(Activity activity,String purchaseToken) 187 | 188 | //消耗商品,通过sku数组 189 | public void consumeAsyncInApp(Activity activity,@NonNull String... sku) 190 | 191 | //消耗商品,通过sku列表 192 | public void consumeAsyncInApp(Activity activity,@NonNull List skuList) 193 | 194 | ``` 195 | 5. 本地订单查询(查询GP本地缓存,不具备高实时性) 196 | 197 | ``` 198 | //取已经内购的商品 199 | public List queryPurchasesInApp(Activity activity) 200 | 201 | //获取已经订阅的商品 202 | public List queryPurchasesSubs(Activity activity) 203 | 204 | ``` 205 | 6. 在线订单查询(联网存,具备高实时性,但查到的是所有订单) 206 | 207 | ``` 208 | //异步联网查询所有的内购历史-无论是过期的、取消、等等的订单 209 | public void queryPurchaseHistoryAsyncInApp(Activity activity) 210 | 211 | //异步联网查询所有的订阅历史-无论是过期的、取消、等等的订单 212 | public void queryPurchaseHistoryAsyncSubs(Activity activity) 213 | 214 | ``` 215 | 7. 工具集合 216 | 217 | ``` 218 | //获取有效订阅的数量 219 | public int getPurchasesSizeSubs(Activity activity) 220 | 221 | //通过sku获取内购商品序号 222 | public int getInAppPositionBySku(String sku) 223 | 224 | //通过sku获取订阅商品序号 225 | public int getSubsPositionBySku(String sku) 226 | 227 | //通过序号获取订阅sku 228 | public String getSubsSkuByPosition(int position) 229 | 230 | //通过序号获取内购sku 231 | public String getInAppSkuByPosition(int position) 232 | 233 | //通过sku获取商品类型 234 | public String getSkuType(String sku) 235 | 236 | ``` 237 | 8. 其他方法 238 | 239 | ``` 240 | //google内购服务是否已经准备好 241 | public static boolean isReady() 242 | 243 | //设置是否自动消耗内购商品 244 | public static void setIsAutoConsumeAsync(boolean isAutoConsumeAsync) 245 | 246 | //断开连接google服务(不要频繁使用) 247 | public static void endConnection() 248 | 249 | ``` 250 | 9. 监听器相关 251 | 252 | ``` 253 | //添加监听器 254 | public GoogleBillingUtil addOnGoogleBillingListener(Activity activity,OnGoogleBillingListener onGoogleBillingListener) 255 | 256 | //移除监听器 257 | public void removeOnGoogleBillingListener(OnGoogleBillingListener onGoogleBillingListener) 258 | 259 | //移除某个页面的所有监听器 260 | public void removeOnGoogleBillingListener(Activity activity) 261 | 262 | //清除内购监听器,防止内存泄漏-在Activity-onDestroy里面调用。 263 | public void onDestroy(Activity activity) 264 | 265 | ``` --------------------------------------------------------------------------------