Good read before starting: If you're confused about components and containers folders, please refer to Dan Abramov's explanation.
(download time not included ~1.5GB for Android Studio)
These instructions assume:
- That you have Step 6 of Starcounter HelloWorld app running on your PC.
- That you have a ready ReactNative Android development environment. To setup this. Please follow these steps to the end. By the end, you should have
react-nativecommand recognizable in your Windows CLI.
git clone https://github.com/StarcounterSamples/ReactNative-HelloWorld.git
cd ReactNative-HelloWorld
ReactNative-HelloWorld> npm install
3. Now, you need to make sure you have an AVD (Android Virtual Device) running and accessible via the ADB. To test that, type:
adb shell
in your command line, and you should have access to the CLI of your Android machine. If you succeed, you can type exit to leave the shell.
Now, you need to navigate to ReactNative-HelloWorld\puppet\puppetContainer.js and change the IP Address to your machine's IP address, keep in mind, that you can't use localhost because it refers to the Android machine itself, Save after the modification.
react-native run-android
It will take up to 5 minutes, and the app will start and connect to you SC instance and it will show the data in the DB!
You might run in some trouble when running the app, please navigate to ReactNative-HelloWorld\android\gradle.properties
And make sure the line
org.gradle.java.home=C:\\Program Files\\Java\\jdk1.8.0_121
Points to the right JDK location.
This app has PuppetJS and JSONPatch embedded inside for ease of setup and use. Soon these two should be separate Node modules referenced in this app.
To save you some time, the files that are mostly interesting for you are in src folder.