react-native-billing | React Native bridge to InApp Billing on Android | Android library
kandi X-RAY | react-native-billing Summary
kandi X-RAY | react-native-billing Summary
React Native bridge to InApp Billing on Android.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Purchase an existing product
- Puts promise
- Reject Promise
- Get the purchase transaction details for a given product
- Map transaction details to a map
- Closes the promise
- Clears the cache
- Opens the billing process
- Check if Iab service is available
- This method is called when an activity is available
- Shortcut method for short circuit activity
- Checks if a product is subscribed
- Checks if the payment details are valid for a given product
- Checks if a product was purchased
- Checks if one timePurchase is supported
- Loads owned accounts from the account
- Request the subscription details
- On product purchase
- Gets details about a purchase
- Subscribes to a user
- Creates the native modules
- Get the transaction transaction details for a given product
- Consumes a purchase
- Lists all owned subscriptions
- List owned products
- Update subscription
react-native-billing Key Features
react-native-billing Examples and Code Snippets
Community Discussions
Trending Discussions on react-native-billing
QUESTION
Okay, so Google is telling us "Background location access not declared" and not letting us publish our app. We have no use for background location, so we're trying to elimiate it completely.
Of course my manifest doesn't have it:
...ANSWER
Answered 2021-Mar-12 at 11:42I had this issue a few weeks ago, what a pain! In my case I had one dependency that was requiring background location without me noticing. Secondly, I had a wrong permission declaration on Google Play so my builds kept being rejected.
1. Find the evil dependencyTo do this I used the Merged Manifest inspector in Android Studio. This shows you what your manifest looks like after all project dependencies have been taken into account. Find ACCESS_BACKGROUND_LOCATION
and double click on it, this will bring you to the actual manifest where it's requested. Scroll to the top of this file and the package=some.package.name
should help you identify what it is. In my case the permission was requested by an old dependency I didn't use anymore so I just uninstalled it.
Note: if you're often working on different branches, make sure you have the correct dependencies installed and make a clean build before checking the merged manifest:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install react-native-billing
npm install --save react-native-billing or yarn add react-native-billing
react-native link react-native-billing
React Native version >= 0.29 Edit MainApplication.java. React Native version < 0.29 Edit MainActivity.java. Step 4.3 is only required if you are using a lower React Native version than 18.0 and/or your MainActivity class does not inherit from ReactActivity.
npm install --save react-native-billing
Add the following in android/setting.gradle
And the following in android/app/build.gradle
Update MainActivity or MainApplication depending on React Native version.
React Native version >= 0.29 Edit MainApplication.java. Add import com.idehub.Billing.InAppBillingBridgePackage; Register package: @Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage(), // add package here new InAppBillingBridgePackage() ); }
React Native version < 0.29 Edit MainActivity.java. Step 4.3 is only required if you are using a lower React Native version than 18.0 and/or your MainActivity class does not inherit from ReactActivity. Add import com.idehub.Billing.InAppBillingBridgePackage; Register package in ReactInstanceManager: .addPackage(new InAppBillingBridgePackage()) Override onActivityResult: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { mReactInstanceManager.onActivityResult(requestCode, resultCode, data); } Larger example: // Step 1; import package: import com.idehub.Billing.InAppBillingBridgePackage; public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler { ... @Override protected void onCreate(Bundle savedInstanceState) { ... mReactInstanceManager = ReactInstanceManager.builder() .setApplication(getApplication()) .setBundleAssetName("index.android.bundle") .setJSMainModuleName("index.android") .addPackage(new MainReactPackage()) // Step 2; register package .addPackage(new InAppBillingBridgePackage()) .setUseDeveloperSupport(BuildConfig.DEBUG) .setInitialLifecycleState(LifecycleState.RESUMED) .build(); ... } // Step 3: For RN < v0.18, override onActivityResult @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { mReactInstanceManager.onActivityResult(requestCode, resultCode, data); } ...
Add your Google Play license key as a line to your android/app/src/main/res/values/strings.xml with the name RNB_GOOGLE_PLAY_LICENSE_KEY. For example:
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