React-native initializing the SDK fails
Hello guys,
So I'm trying to launch the react-native sample (GitHub - Rainbow-CPaaS/Rainbow-React-Native-Samples) with android.
I saw in the react-native guide (Rainbow API Hub | SDK and API documentation and samples (openrainbow.com)) that I need to have to create a configuration json file, set my app credentials and then initialize the sdk with that method:
RainbowPackage.initializeRainbowSdk
But when I try to build the app, the build fails.
C:\Workspace\Rainbow-React-Native-Samples\android\app\src\main\java\com\example\reactnativerainbowmodule\MainApplication.java:54: error: cannot find symbol
RainbowPackage.initializeRainbowSdk
^
symbol: method initializeRainbowSdk(MainApplication,String,String,String)
location: class RainbowPackage
1 error
FAILURE: Build failed with an exception.
In my opinion, it was an old way to initialize the sdk and the documentation is outdated for the android part. It looks like that the method doesn't exist anymore.
Am I right, is the documentation outdated ? If yes, can you explain how you initialize the sdk now ?
Thank you in advance.
-
Hi Soufiane,Thank you for your notes, the Docs are outdated in this part particularly, and we will fix it as soon as we can.However, the react-native sample code is already updated with the last Rainbow Package changes [https://github.com/Rainbow-CPaaS/Rainbow-React-Native-Samples/blob/main/android/app/src/main/java/com/example/reactnativerainbowmodule/MainApplication.java].In the meanwhile, you can update your code like the following :```public class MyApp extends Application {@Overridepublic void onCreate() {super.onCreate();RainbowPackage.setApplication(this);// RainbowPackage.initializeRainbowSdk(this, "applicationId", "applicationSecretKey", host); <= Just remove this line only and the sample app should be working fine}}```
-
Hello thank you for your answer,
Is there also a way to tell which host I want to use, I want to work with the sandbox host (sandbox.openrainbow.com) but I think by default he takes the openrainbow.com host.
I put the appId and secret key for the sandbox host but I see in the asyncStorage that the host by default is openrainbow.com.
Should I just set the value in the AsyncStorage? If yes, where?
-
Hello Soufiane,
You can set the host value when you click 5 times on the following button [please check the attached image], and then you can change the host value from `openrainbow.com` to `sandbox.openrainbow.com`.
And regarding `default always takes the openrainbow.com host`, indeed its a bug, we will fix it by the coming new release.
Please sign in to leave a comment.
Comments
3 comments