Skip to content

mRcSchwering/ankerwache

Repository files navigation

Ankerwache

Anchor watch app. Set an anchor somewhere, define a radius, and let it wake you up if your boat drifts away at night. This app is similar to AnkerAlarm but I will not add many features and instead focus on reliability. Built with React Native and Expo.

I did some simulations regarding false alarm rates, the likely time for an alarm to be raised, and likely distance a boat has drifted after an alarm was raised. See specificity_sensitivity.py.

Privacy Policy

No data is collected or send anywhere. Period

Description

This is a tool to help you sleep better while at anchor. Set your anchor position, define a radius, and start the anchor watch. If your phone is persistently outside the defined radius it will start to ring loudly.

In contrast to other anchor apps this one comes without any other feature and without ads. It also doesn't need internet connection. The only focus here is having a reliable anchor watch.

No false alarms Your phone's GPS is not always as accurate as you think. When you set the alarm radius you will see the GPS error. Use the length of your chain/rode plus twice the error to avoid false alarms. To further reduce the chances of false alarms I implemented a counter which will count up on out-of-bounds readings. Only with multiple consecutive out-of-bounds readings the alarm will start.

Reliability The active anchor watch shows a notification on your screen. However, many android devices suspend apps after several minutes of inactivity. This website explains these problems for different manufacturers: dontkillmyapp.com. Notably, you need to make sure that the Battery Saver does not suspend this app after some minutes of inactivity. Apart from that, the app will show a notification as long as its anchor watch is active.

Privacy This app does not download anything and does not send anything. It only requests the geolocation every 5s and compares it. Nothing is saved.

Donate All my apps are free, I never use ads, or sell data to third parties. If you want to support me somehow, you can donate with this link on buymeacoffee.com. Thanks in advance.


buymeacoffee


home set anchor set radius

Develop

See React Native docs and Expo docs for APIs and components.

npm install
npm start

Build

Needs an Expo account and the Expo CLI. I also need the Android SDK Tools for adb. I did it the manual way. Didn't work exactly as described:

  • extracted it to ~/android-sdk/cmdline-tools/latest/
  • had to move bin/ and lib/ under latest/ (from the sdk root they need to be under cmdline-tools/latest/)
  • then after running the 3 described commands there are various directories under ~/android-sdk/
  • had to update my ~/.bashrc like below to make adb --verion work
export ANDROID_SDK_ROOT=/home/marc/android-sdk/
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/

At some point I needed a key store to sign this project. I auto-generated it and fetched it (expo fetch:android:keystore) afterwards as backup.

Standalone apk with Expo-CLI

I have configured the eas.json to .apk. I can build it iwth EAS.

eas login

eas build --platform android --profile preview

Download .apk from output URL. See below for testing on device.

Playstore aab with Expo-CLI

Creates an .aab for upload to Google Playstore. Make sure to increment "version": and "versionCode": in app.json before building. The playstore only understands versionCode to identify an update.

eas login

eas build --platform android --profile production

Test on Device

I needed this answer to enable "install via USB" without needing to create a Mi account

For running a standalone build myapp.apk on Redmi Note 8 Pro. See android docs and adb docs. Ubuntu prerequesites include android-sdk-platform-tools-common and the plugdev group.

  1. (mobile) Go to Settings > Developer Options
  2. (mobile) enable Wireless debugging
  3. (mobile) under Wireless debugging select Pair device with QR Code: note IP adress, port, code
  4. (PC) adb pair <ip-address>:<port> then enter code when prompted
  5. (mobile) under Wireless debugging note IP adress and port
  6. (PC) adb connect <ip-adress>:<port>
  7. (PC) adb devices -l and note transport_id
  8. (mobile) enable Install via USB
  9. (PC) adb -t <transport-id> install myapp.apk

After testing, on the mobile go to Wireless debugging and forget device, then remove special permissions Wireless debugging and Install via USB again. On the PC run adb disconnect && adb kill-server.