A proof-of-concept Android application to monitor and detect GNSS anomalies in maritime domain. The app uses AIS data from Digitraffic (service by Fintraffic) to display realtime vessel movements in addition to data from Android devices built-in GNSS receiver. Other core tech used includes React Native development libraries and MapLibre. The project was done for TUNI project course COMP.SE.610/620 and it was collaborated together with TUNI GNSS unit.
Running scripts in elevated powershell is vital!
- Setup your environment according to this guide
⚠️ IMPORTANT: Set up environment variables - See SECURITY_SETUP.md for instructionscp .env.example .env # Edit .env and add your MapTiler API key- Create AVD (Android Virual Device) with Android 35 SDK and bring it up and running.
- Run the development servers. The project was initialized according to this guide
npm install
npm start # this will start Metro (javascript build tool), suggested to be running in its own terminal
npm run android # this should open an android emulator and after a while it should install the app- Try doing some changes in the codebase and see if the changes are reflected
The project supports Prettier for code formatting so following should make your life a little bit easier
- Install Prettier VS Code extension
- In VS Code select Prettier as you default formatter
- If you
Ctrl+Shift+Pand runFormat Documentit should as you to configure your default on your first run
- If you
- (Set autoformatting on:
Settings => Format on save)
- After
git pulling your code remember tonpm installto get the new packages - Start your android emulator either from
- Android Studio => Virtual Device Manager
- from shell (you get more logs this way) deault path in Windows
C:\Users\<USER>\AppData\Local\Android\Sdk\emulator
- From elevated shell navigate to repo and
npm startto run the node server - Open another elevated shell and from repo
npm run android
- This should install the application to the emulator and start it automatically
- Running this script will start development server and emulator on its own but at least I had some issues with running it this way
- Try doing some changes in the code and save. Changes should be reflected after loading.
- You can try running the React Native doctor to diagnose any remaining problems:
npx react-native doctor - Gradle seems to be a little bit pain in the back. Uninstalling
c:/users/<user>/.gradleand running theandroidscript seems to solve some things - To clean gradel cache do following
# in repo folder
cd android
.\gradle clean
# if it doesn't work try stopping the gradle service with
.\gradlew --stop
# to display gradle instances
.\gradlew --status-
If you are running this on a laptop and your avd is not starting, it may be due to screen size being too small. I switched display scaling from 125% too 100% and emulator started succesfully.
-
You can clear Metro cache by running
npm start -- --reset-cache- If changing environments becomes a problem (doing changes in
.envfiles), try uninstalling the app manually from the device and then reinstalling. Also try cleaning any caches before reinstallation.
Following should work at least on Windows with elevated Powershell
# Clean gradle cache
cd android
./gradlew clean
# Run metro and clean its cache
npm start -- --reset-cache
# !! Remove the application from the connected device
# Build the app for production
npm run android -- --mode="release"
# The built apk should appear in folder android\app\build\outputs\apk\releaseThis is a new React Native project, bootstrapped using @react-native-community/cli.