-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab2b61f
commit 9e303e5
Showing
37 changed files
with
2,969 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
|
||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:0.8.+' | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
mavenCentral() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Project-wide Gradle settings. | ||
|
||
# IDE (e.g. Android Studio) users: | ||
# Settings specified in this file will override any Gradle settings | ||
# configured through the IDE. | ||
|
||
# For more details on how to configure your build environment visit | ||
# http://www.gradle.org/docs/current/userguide/build_environment.html | ||
|
||
# Specifies the JVM arguments used for the daemon process. | ||
# The setting is particularly useful for tweaking memory settings. | ||
# Default value: -Xmx10248m -XX:MaxPermSize=256m | ||
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 | ||
|
||
# When configured, Gradle will run in incubating parallel mode. | ||
# This option should only be used with decoupled projects. More details, visit | ||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects | ||
# org.gradle.parallel=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apply plugin: 'android' | ||
|
||
android { | ||
compileSdkVersion 17 | ||
buildToolsVersion "19.0.0" | ||
|
||
defaultConfig { | ||
minSdkVersion 11 | ||
targetSdkVersion 19 | ||
versionCode 2 | ||
versionName "1_1" | ||
} | ||
buildTypes { | ||
release { | ||
runProguard false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' | ||
|
||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile 'com.android.support:appcompat-v7:+' | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in D:/DevMobile/sdk1/eclipse_Android_SDK/android-sdk_r18-windows/android-sdk-windows/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the ProGuard | ||
# include property in project.properties. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.survivingwithandroid.torch" | ||
> | ||
|
||
<uses-permission android:name="com.android.vending.BILLING" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@drawable/ic_launcher" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme" | ||
android:debuggable="false"> | ||
<activity | ||
android:name="com.survivingwithandroid.torch.MainActivity" | ||
android:label="@string/app_name" > | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
144 changes: 144 additions & 0 deletions
144
TorchApp/torch/src/main/aidl/com/android/vending/billing/IInAppBillingService.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
/* | ||
* Copyright (C) 2012 The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.android.vending.billing; | ||
|
||
import android.os.Bundle; | ||
|
||
/** | ||
* InAppBillingService is the service that provides in-app billing version 3 and beyond. | ||
* This service provides the following features: | ||
* 1. Provides a new API to get details of in-app items published for the app including | ||
* price, type, title and description. | ||
* 2. The purchase flow is synchronous and purchase information is available immediately | ||
* after it completes. | ||
* 3. Purchase information of in-app purchases is maintained within the Google Play system | ||
* till the purchase is consumed. | ||
* 4. An API to consume a purchase of an inapp item. All purchases of one-time | ||
* in-app items are consumable and thereafter can be purchased again. | ||
* 5. An API to get current purchases of the user immediately. This will not contain any | ||
* consumed purchases. | ||
* | ||
* All calls will give a response code with the following possible values | ||
* RESULT_OK = 0 - success | ||
* RESULT_USER_CANCELED = 1 - user pressed back or canceled a dialog | ||
* RESULT_BILLING_UNAVAILABLE = 3 - this billing API version is not supported for the type requested | ||
* RESULT_ITEM_UNAVAILABLE = 4 - requested SKU is not available for purchase | ||
* RESULT_DEVELOPER_ERROR = 5 - invalid arguments provided to the API | ||
* RESULT_ERROR = 6 - Fatal error during the API action | ||
* RESULT_ITEM_ALREADY_OWNED = 7 - Failure to purchase since item is already owned | ||
* RESULT_ITEM_NOT_OWNED = 8 - Failure to consume since item is not owned | ||
*/ | ||
interface IInAppBillingService { | ||
/** | ||
* Checks support for the requested billing API version, package and in-app type. | ||
* Minimum API version supported by this interface is 3. | ||
* @param apiVersion the billing version which the app is using | ||
* @param packageName the package name of the calling app | ||
* @param type type of the in-app item being purchased "inapp" for one-time purchases | ||
* and "subs" for subscription. | ||
* @return RESULT_OK(0) on success, corresponding result code on failures | ||
*/ | ||
int isBillingSupported(int apiVersion, String packageName, String type); | ||
|
||
/** | ||
* Provides details of a list of SKUs | ||
* Given a list of SKUs of a valid type in the skusBundle, this returns a bundle | ||
* with a list JSON strings containing the productId, price, title and description. | ||
* This API can be called with a maximum of 20 SKUs. | ||
* @param apiVersion billing API version that the Third-party is using | ||
* @param packageName the package name of the calling app | ||
* @param skusBundle bundle containing a StringArrayList of SKUs with key "ITEM_ID_LIST" | ||
* @return Bundle containing the following key-value pairs | ||
* "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on | ||
* failure as listed above. | ||
* "DETAILS_LIST" with a StringArrayList containing purchase information | ||
* in JSON format similar to: | ||
* '{ "productId" : "exampleSku", "type" : "inapp", "price" : "$5.00", | ||
* "title : "Example Title", "description" : "This is an example description" }' | ||
*/ | ||
Bundle getSkuDetails(int apiVersion, String packageName, String type, in Bundle skusBundle); | ||
|
||
/** | ||
* Returns a pending intent to launch the purchase flow for an in-app item by providing a SKU, | ||
* the type, a unique purchase token and an optional developer payload. | ||
* @param apiVersion billing API version that the app is using | ||
* @param packageName package name of the calling app | ||
* @param sku the SKU of the in-app item as published in the developer console | ||
* @param type the type of the in-app item ("inapp" for one-time purchases | ||
* and "subs" for subscription). | ||
* @param developerPayload optional argument to be sent back with the purchase information | ||
* @return Bundle containing the following key-value pairs | ||
* "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on | ||
* failure as listed above. | ||
* "BUY_INTENT" - PendingIntent to start the purchase flow | ||
* | ||
* The Pending intent should be launched with startIntentSenderForResult. When purchase flow | ||
* has completed, the onActivityResult() will give a resultCode of OK or CANCELED. | ||
* If the purchase is successful, the result data will contain the following key-value pairs | ||
* "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on | ||
* failure as listed above. | ||
* "INAPP_PURCHASE_DATA" - String in JSON format similar to | ||
* '{"orderId":"12999763169054705758.1371079406387615", | ||
* "packageName":"com.example.app", | ||
* "productId":"exampleSku", | ||
* "purchaseTime":1345678900000, | ||
* "purchaseToken" : "122333444455555", | ||
* "developerPayload":"example developer payload" }' | ||
* "INAPP_DATA_SIGNATURE" - String containing the signature of the purchase data that | ||
* was signed with the private key of the developer | ||
* TODO: change this to app-specific keys. | ||
*/ | ||
Bundle getBuyIntent(int apiVersion, String packageName, String sku, String type, | ||
String developerPayload); | ||
|
||
/** | ||
* Returns the current SKUs owned by the user of the type and package name specified along with | ||
* purchase information and a signature of the data to be validated. | ||
* This will return all SKUs that have been purchased in V3 and managed items purchased using | ||
* V1 and V2 that have not been consumed. | ||
* @param apiVersion billing API version that the app is using | ||
* @param packageName package name of the calling app | ||
* @param type the type of the in-app items being requested | ||
* ("inapp" for one-time purchases and "subs" for subscription). | ||
* @param continuationToken to be set as null for the first call, if the number of owned | ||
* skus are too many, a continuationToken is returned in the response bundle. | ||
* This method can be called again with the continuation token to get the next set of | ||
* owned skus. | ||
* @return Bundle containing the following key-value pairs | ||
* "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on | ||
* failure as listed above. | ||
* "INAPP_PURCHASE_ITEM_LIST" - StringArrayList containing the list of SKUs | ||
* "INAPP_PURCHASE_DATA_LIST" - StringArrayList containing the purchase information | ||
* "INAPP_DATA_SIGNATURE_LIST"- StringArrayList containing the signatures | ||
* of the purchase information | ||
* "INAPP_CONTINUATION_TOKEN" - String containing a continuation token for the | ||
* next set of in-app purchases. Only set if the | ||
* user has more owned skus than the current list. | ||
*/ | ||
Bundle getPurchases(int apiVersion, String packageName, String type, String continuationToken); | ||
|
||
/** | ||
* Consume the last purchase of the given SKU. This will result in this item being removed | ||
* from all subsequent responses to getPurchases() and allow re-purchase of this item. | ||
* @param apiVersion billing API version that the app is using | ||
* @param packageName package name of the calling app | ||
* @param purchaseToken token in the purchase information JSON that identifies the purchase | ||
* to be consumed | ||
* @return 0 if consumption succeeded. Appropriate error values for failures. | ||
*/ | ||
int consumePurchase(int apiVersion, String packageName, String purchaseToken); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.