This is a Cordova app that implements everything required to run a gateway to connect to nRF Cloud.
Pre-reqs:
- Have NodeJS and npm installed
- Cordova installed. This should be as simple as
npm i -g cordova
- This repo, obviously.
- Copy the
.env.sample
file to.env
and fill out details if you'd like to auto-fill your username and password - Copy the two sample files in
./config
tocodepush.json
andkeystore.json
. Fill out the information if you have it. - Checkout the gateway-common repo into the parent directory (so it can satisfy the dependency in package.json.)
- Make sure you
npm i
andnpm run build
in the gateway directory
- Make sure you
Not required for building, but required for deployment:
- Microsoft AppCenter/CodePush. This is used to push updates to the apps that don't have to go through the app store process.
- To get started with your own distribution, see this guide.
Steps to build:
npm i
(only needed once, of couse)npm run build
To test locally (in a browser):
npm run watch
This is tricky. The easiest environment for this is Android.
Follow the "Create your first app" guide on Cordova's website.
You'll need to also follow the platform guide for the platform you're building for. For example, the Android platform guide.
Probably the easiest shortcut is to install Android Studio. You don't really need the whole studio, but it's a nice and easy package.
Once you think you've got everything installed, you can test:
cordova platform add android
cordova requirements
Once everything is a-okay, you can do the following:
npm run build
(if you haven't yet)cordova build android
It should successfully build the Android app.
You can use cordova run android
to build and automatically install it on your phone. Make sure that your phone is detected correctly by running adb devices
before doing this. Otherwise it will try to start an emulator.