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.
- Copy the
.env.sample
file to.env
and fill out details if you'd like to auto-fill your username and password - Copy the sample file in
./config
tokeystore.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
Steps to build:
npm i
(only needed on first build)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.
There's a couple of Gulp tasks to make this a bit easier.
Warning: these tasks will revert any uncommited changes to config.xml. Be sure you are okay with this before you run the tasks.
Android - Task: buildAndroid
Before running this task, make sure you copy keystore.sample.json
to keystore.json
and fill out the details. Be sure not to accidentally check in this file or the keystore itself.
This task will ask for the store and alias passwords. These will be used to build the production APK.
After a successful build, there will be two files in the built
folder. One for staging and one for production. Use the production one to create the update on the app store.
iOS - Task: buildIos
This task is more straight-forward than Android simply because you're stuck using Xcode for the final steps instead of a command-line tool. After running this task, open the project (./platforms/ios) in Xcode and follow the normal deploy process for iOS apps through Xcode.