Could not initConnection on version 2.2.2
See original GitHub issueVersion of react-native-iap
2.2.2 (latest) React native 57.0
Platforms you faced the error (IOS or Android or both?)
Android
Expected behavior
Could init connection
Actual behavior
Init connection returns null
Tested environment (Emulator? Real Device?)
Differents real devices
Steps to reproduce the behavior
-
I have created a alpha testing app in the playstore with the package com.mycompany.myapp
-
I have created and activated products and subscriptions
-
The app is on “Published” state on the playstore
-
The merchant account is active
-
I have integrated the library, added and linked it.
-
I have tried this:
import * as RNIap from 'react-native-iap';
try {
let cnn = await RNIap.initConnection();
if(cnn){
console.warn(cnn)
}else{
console.warn("Nope")
}
let products = await RNIap.getProducts(itemSkus);
console.warn(products )
} catch(err) {
console.warn(err);
}
}
cnn = null and getProducts = empty array
The app.build.gradle has:
compile project(':react-native-iap')
The settings.gradle has:
include ':react-native-iap'
project(':react-native-iap').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-iap/android')
The Manifest has this permissions:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.android.vending.BILLING" />
Im running the app using react-native run-android
Any ideas of how can i troubleshoot this?
Also, how is this library working? the initConnection method checks if there is any app in the playstore with the app id = com.mycompany.myapp ?
Thanks
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (2 by maintainers)
Thats an ios issue with the purchase, i cant even get the connection… any ideas?
Also, make sure that if you are using getProducts youre trying to getting consumable products instead of subscription. There is a getSubscriptions method for that.