nytimes / register Goto Github PK
View Code? Open in Web Editor NEWAndroid Library and App for testing Play Store billing
License: Other
Android Library and App for testing Play Store billing
License: Other
Register gets Permission denied trying to read register.json config file on Android Q devices. This is due to https://developer.android.com/preview/privacy/scoped-storage
Tried to install the companion app on three different devices via different acquisition channels:
All devices allow sideloading, the ones on A8 and A9 are just saying that the app wasn't installed. My A7 device with Lineage additionally states the package appears to be corrupt.
Am I missing something here?
Tests that were removed due to Play-Billing library:
Let's see what we can do to try and cover what was lost in the above tests when it comes to PBL.
Google has a new library that wraps around in app billing: Play Billing Library Since Register also wraps around in app billing, some extra work will be required to use Register with the new library.
https://github.com/daimajia/AndroidSwipeLayout is the library we use to do swipe gesture detecting. I believe since we made the move to AndroidX this is causing problems. It should be replaced with either our own solution or maybe get rid of the gesture altogether
It seems like a user has to manually configure the separate app to test different flows. Is it possible to set the desired value programmatically in the context of an automated test?
in README.MD the "'com.nytimes.android.register:0.0.2'" is mistyped. The last dot have to be colon: "'com.nytimes.android:register:0.0.2'"
Convert companion app to Kotlin
As of now, you have to separately install the config app in order to use register. If the version of Register you've coupled with your app is different than the version of the companion app, you can run into issues. If we can automatically deploy the config app with your app (like LeakCanary does), then that issue would be mitigated and would be a nicer experience.
App crash when i try to run. This is log file. And I can't install RegisterCompanion apk.
2018-11-02 18:00:31.550 20130-20130/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.nytimes.android.external.register.sample, PID: 20130
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nytimes.android.external.register.sample/com.nytimes.android.external.register.sample.SampleActivity}: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2926)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3061)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
at android.os.Handler.dispatchMessage(Handler.java:114)
at android.os.Looper.loop(Looper.java:198)
at android.app.ActivityThread.main(ActivityThread.java:6716)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.get(ArrayList.java:437)
at com.android.billingclient.api.BillingClientTesting$BillingContextWrapper.bindService(BillingClientTesting.java:120)
at com.android.billingclient.api.BillingClientImpl.startConnection(BillingClientImpl.java:237)
at com.android.billingclient.api.BillingClientTesting.startConnection(BillingClientTesting.java:53)
at com.nytimes.android.external.registerlib.GoogleServiceProviderTesting.startConnection(GoogleServiceProviderTesting.java:37)
at com.nytimes.android.external.register.sample.SampleActivity.initGoogleServiceProvider(SampleActivity.java:189)
at com.nytimes.android.external.register.sample.SampleActivity.onCreate(SampleActivity.java:80)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2906)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3061)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
at android.os.Handler.dispatchMessage(Handler.java:114)
at android.os.Looper.loop(Looper.java:198)
at android.app.ActivityThread.main(ActivityThread.java:6716)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Work is being done in: feature/products_edit
Prelim work is being done in feature/products_edit. This work would require use register.json
as a seed file for a database.
Since we store a product receipts, what happens when a product is edited?
Solution: Clone the product and mark as active
and the source product is marked inactive
. This will allow us to query for previous products (e.g. viewing the receipts). This has the added benefit to play nice with receipts once they are moved from strings into database entries. They are currently stored as strings in shared-prefs.
Currently we're using Support 27.1.1, which is fine for now, but in order to move towards things like TestX it would be better if we fully moved over to AndroidX.
All resources in a library default to public. To make all resources implicitly private, you must define at least one specific attribute as public. Resources include all files in your project’s res/ directory, such as images. To prevent users of your library from accessing resources intended only for internal use, you should use this automatic private designation mechanism by declaring one or more public resources.
To declare a public resource, add a declaration to your library’s public.xml file. If you haven’t added public resources before, you need to create the public.xml file in the res/values/ directory of your library.
The following example code creates two public string resources with the names mylib_app_name and mylib_public_string:
Currently, BillingContextWrapper will crash when onBindService is called, because package manager returns queryIntentServices w/ a list of size 0.
We should be able to recover from this gracefully and show an error / toast of some type.
Right now it can be a pain as you have to remember to push the updated version of the config file before you try to access it.
One possible idea is linked to #63, since the config app would be deployed with your app, you could include the config file in your app's source and Register reads from it there.
Also #11 would be nice :)
The last version of Google Play Billing Library, 3.0.1, currently used in the lib is 2.2
After solving #59 with a new .apk file, the Compaion app keeps crashing on launch.
Behaviour:
Without register.json, app comes up fine and shows a text field prompting the user to put a register.json to sdcard/ .
Even with the provided json sample from the README page, the app crashes, doesn't even come up with any UI.
File content:
{
"skus": {
"register.sample.iap": {
"type": "inapp",
"price" : "1.00",
"title" : "Sample In App Purchase Item",
"description" : "This is an in app purchase item for use with Register sample app",
"package" : "com.nytimes.android.external.register"
},
"register.sample.sub": {
"type": "subs",
"price" : "10.00",
"title" : "Sample Subscription Item1",
"description" : "This is a subscription item for use with Register sample app",
"package" : "com.nytimes.android.external.register"
}
},
"users": [
"[email protected]",
"[email protected]"
]
}
File name:
register.json
Location:
/sdcard
Pain points of having the app separate from the library:
Possible solutions:
debug
and release
flavours so that the code is only present in the debug version. In this case, it means providing all our dependencies as debug only, and make sure we don't rely on the library BuildConfig.DEBUG
flag but on the external app.What do you think?
Lets have a discussion talking about what we need to do to release 1.0 version of Register.
Most Important: Re-Add Tests (This is on NYT)
Additional?
Do we agree this is a minimum bar to get to 1.0 release? Do we disagree? Any suggestions?
The Play Store's purchase UI has moved to a bottom sheet from the old dialog. We currently display as a dialog. It would be nice to make ours look the same way.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.