Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only query Google Play after app launch and potential purchases
Summary: Previously, we triggered our in-app purchase auto-logging: 1. When the app was first launched 2. In the onActivityResume callback. This means every time an application activity was resumed, we queried Google play for in-app purchase info and product info. This is very inefficient, as it leads to many network requests, even when there is seemingly no in-app purchase related events on the application layer. While debugging, I discovered that [this activity, titled ProxyBillingActivity](https://github.com/DimaDake/billing/blob/master/library/src/main/java/com/android/billingclient/api/ProxyBillingActivity.java), is the name of the Google Play Activity that surfaces when a user has the ability to make an in-app purchase. This is the case for Google Play Billing Libraries 2 through 7. Therefore, to log in-app purchases, we can send requests to Google Play only after this activity is closed (and still during app launch to catch any edge cases). This will reduce unnecessary network requests by ``> 99% ``! Reviewed By: jjiang10 Differential Revision: D62056860 fbshipit-source-id: 647a175b9897f96e695cd5c78d4cf919f7b7a13e
- Loading branch information