I have a mobile app (iOS and android compatible) that needs to know if it's far or close to the user's laptop/ desktop (e.g. whether it's within 5 meters or not). I need to make it secure such that only the user's phone can connect to that laptop/ desktop, but other than that there's no other requirements.

Does anyone know how to do this?

My research so far:

  1. Bluetooth BLE seems to be the recommended technology to use. Covid contact tracing softwares are leveraging the same tech.

  2. However, I'm struggling to find any reference that can turn a laptop to a BLE peripheral. It's usually the other way around (the phone is the peripheral). In my case the laptop needs to advertise, and the phone's the one measuring the distance.

  3. I found a nodejs library called bleno and it does the job. However, it seems that the features are limited (e.g. it can't reject a connection attempt from any unknown devices). It's also impractical for end users to download this (or any nodejs app in general).

  4. Chrome plugins don't seem to have access to mac OS or PC's bluetooth, so I guess that's not an option.

Does that leave me with having to develop native MacOS or PC apps just to connect with the mobile app? Or is there a better approach?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.