play-billing-samples | Samples for Google Play In-app Billing
kandi X-RAY | play-billing-samples Summary
kandi X-RAY | play-billing-samples Summary
Sample applications for Google Play Billing. To build each sample, see the README instructions in the project directory.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of play-billing-samples
play-billing-samples Key Features
play-billing-samples Examples and Code Snippets
Community Discussions
Trending Discussions on play-billing-samples
QUESTION
In researching answers for my question here I found (after several days of very frustrating work) references to the kotlin billing library "billing.ktx" which a couple of Developer pages claim
contains Kotlin extensions and coroutines support that enable you to write idiomatic Kotlin when using Google Play's billing system
but gives neither details nor links for more information. The Play billing examples, "Classy Taxi" and "TrivialDrive" have been rewritten to use Kotlin but hardly "idiomatic Kotlin", and certainly not using coroutines, nor do they use this library. They are now two years old and showing their age in this fast moving arena.
My question is specifically what does this library offer in terms of idiomatic Kotlin or even coroutine support? I am making some headway with some billing client functions (as can be seen in the referenced question) before using this library, but I can't see what difference using it makes. To be even more specific, "launchBillingFlow" looks impossible to convert, but is it?
Just links to somewhere to find information would be enough. Why is it so hard to find more than class definitions for the billing client?
...ANSWER
Answered 2021-Mar-17 at 18:22I can find no documentation. Everything in this answer comes from looking through the billing-ktx
aar that appears when I add a dependency on this library to my project.
This library looks pretty minimal. It provides three new "result" classes as well as four extension funtions on BillingClient
to replace callback-based code with suspend fun
s.
QUESTION
The following code is about Google in-app payment based office sample code.
I have to test it in a real mobile phone because it' hard to test Google in-app payment in Android Studio emulator.
Unfortunately, the app crashed in real mobile phone when I open the FragmentBuy
, I hardly get the error information about the crash.
I checked my code again and agin, I guest there are two place which cause crash, one is private fun processPurchases(purchasesResult: Set)
, another is private fun acknowledgeNonConsumablePurchasesAsync(nonConsumables: List)
.
1: They lanuch Toast.makeTex
in in asynchronous thread, is it reason of crash?
2: Which one is correct between Billing.getInstance(requireActivity(), getString(R.string.skuRegisterApp))
and Billing.getInstance(requireContext), getString(R.string.skuRegisterApp))
?
3: Is there other problems with my code ?
FragmentBuy.kt
...ANSWER
Answered 2020-Aug-04 at 02:41to show Toast
your Thread
must be has MessageQueue
, In this case I recommend you using Activity
instead of Context
and using method runOnUiThread
QUESTION
The Code A is from the project play-billing-samples, you can see here.
I think that "SELECT * FROM gold_status LIMIT 1"
maybe return no record, I don't know whether fun getGoldStatus(): LiveData
is correct statement, I think it should be Code B, right?
Code A
...ANSWER
Answered 2020-May-18 at 09:28Code A is right, since not the data from database is returned but an observable data class holder (LiveData), this will be returned even if there is no record in the table. You can then attach an Observer to this observable, the observer will be triggered once changes to database occur w.r.t. your query (You can find several examples for this in the Android Documentation). The getValue() method of a LiveData object can return null though, if no value has been set yet, but usually you use Observers for changes of the LiveData.
QUESTION
The Code A is from the project play-billing-samples
, you can see it.
I don't know why the author design localCacheBillingClient
as lateinit
, it cause the code is little complex, if (::localCacheBillingClient.isInitialized == false) {...}
are invoked many times.
I think Code B can works well, right?
Code A
...ANSWER
Answered 2020-May-20 at 07:44Kotlin - Property initialization using "by lazy" vs. "lateinit"
I believe the answer lies in this thread and precisely below point.
lateinit var can be initialized from anywhere the object is seen from, e.g. from inside a framework code, and multiple initialization scenarios are possible for different objects of a single class. by lazy { ... }, in turn, defines the only initializer for the property, which can be altered only by overriding the property in a subclass. If you want your property to be initialized from outside in a way probably unknown beforehand, use lateinit.
QUESTION
Google published a brand new version to handle the payments in Android but after searching quite a while I cannot find a single example or tutorial from someone who succeeded implementing it.
The documentation is very short and provides only a part of the necessary code: https://developer.android.com/google/play/billing/billing_library_overview
The only sample provided is made with Kotlin: https://github.com/android/play-billing-samples
Seems like they forgot about Java developers...
Does anyone know a tutorial online or succeeded to implement it? My current code is far from working to be published yet.
...ANSWER
Answered 2020-Jan-14 at 15:14Here is my implementation using billing 2.1.0 in Kotlin. You can easily convert it to Java if you see the whole picture (that's why I'm pasting you the entire activity).
QUESTION
The following Code A is from the project play-billing-samples.
Can I use is null instead of isInitialized
in Kotlin? just like Code B
Code A
...ANSWER
Answered 2020-May-15 at 02:30Yes, you can, but you'd have to change the type of the variable to LocalBillingDb?
and get rid of the lateinit
modifier:
QUESTION
I am struggling for days to implement android user subscription into android. I am using the google dev tutorial for Java in-app purchases:
https://github.com/android/play-billing-samples/tree/master/ClassyTaxiJava
At the last section, I need to deploy backend Server as described here:
https://github.com/android/play-billing-samples/tree/master/ClassyTaxiServer
What I did:
- cloned the server files and folders in the tutorial into my PC
- Opened CMD and directed to the folder
- logged into firebase by
firebase login
--> OK - added the firebase project by
firebase use -add
--> OK - initiated a function command
firebase functions:config:set app.package_name="com.mypackage.app"
--> OK deploy firebase
--> ERROR
Error is as below:
...ANSWER
Answered 2020-Apr-19 at 03:45look at this code brother i m using it in my firebase functions the code lies in index.ts
QUESTION
I've followed all the steps in here to get the "Classy Taxi: Google Play Billing Subscriptions Android App Java Sample" running, however on the last step I'm very confused, it´s not clear to me as to how I´m supposed to deploy the back-end, here are the steps:
These are steps to build the backend server code located here
- Make sure you have installed Node.js, npm, and Firebase CLI.
- Run
npm install
to install dependencies. - Configure Cloud Functions for Firebase with your Android app and subscription products:
ANSWER
Answered 2020-Apr-13 at 01:41See the Firebase CLI reference. This should be the project's root directory ClassyTaxiServer
; assuming that you've ran all previous steps successfully, before attempting to firebase deploy
. firebase.json
knows what to do... however, that file is the actual problem; see PR #289.
Update firebase.json
to this version and it should work out:
QUESTION
On upgrading the billingclient to 2.1.0:
...ANSWER
Answered 2020-Apr-08 at 17:18My solution ended up being not to bother with the Trivial Drive example at all. The current implementation is simple enough to implement directly starting here https://developer.android.com/google/play/billing/billing_library_overview.
The tricky part right from the start is this line:
QUESTION
I've recently ran into:
...ANSWER
Answered 2019-Oct-20 at 11:51Deleting the directories .idea and .gradle in the project's root directory, invalidating caches and restarting android worked (at least for now).
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install play-billing-samples
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page