Skip to content

yjeanrenaud/yj_nearbyglasses

Repository files navigation

yj_nearbyglasses

attempting to detect smart glasses nearby and warn you. Screenshot Nearby Glasses

⚠ WARNING! ⚠

HARASSING someone because you think they are wearing a covert surveillance device can be a criminal offence. It may even be a more serious offence than using such a device. Please seek legal advise regarding your local laws on this matter.

⚠ DO NOT HARASS ANYONE AT ALL ⚠


Nearby Glasses

The app, called Nearby Glasses, has one sole purpose: Look for smart glasses nearby and warn you.

Get It On Google Play

Table of contents

This app notifies you when smart glasses are nearby. It uses company identificators in the Bluetooth data sent out by these. Therefore, there likely are false positives (e.g. from VR headsets). Hence, please proceed with caution when approaching a person nearby wearing glasses. They might just be regular glasses, despite this app’s warning.

The app’s author Yves Jeanrenaud takes no liability whatsoever for this app nor it’s functionality. Use at your own risk. By technical design, detecting Bluetooth LE devices might sometimes just not work as expected. I am no graduated developer. This is all written in my free time and with knowledge I taught myself.
False positives are likely. This means, the app Nearby Glasses may notify you of smart glasses nearby when there might be in fact a VR headset of the same manufacturer or another product of that company’s breed. It may also miss smart glasses nearby. Again: I am no pro developer.
However, this app is free and open source, you may review the code, change it and re-use it (under the license).
The app Nearby Glasses does not store any details about you or collects any information about you or your phone. There are no telemetry, no ads, and no other nuisance. If you install the app via Play Store, Google may know something about you and collect some stats. But the app itself does not.
If you choose to store (export) the logfile, that is completely up to you and your liability where this data go to. The logs are recorded only locally and not automatically shared with anyone. They do contain little sensitive data; in fact, only the manufacturer ID codes of BLE devices encountered.

Use with extreme caution! As stated before: There is no guarantee that detected smart glasses are really nearby. It might be another device looking technically (on the BLE adv level) similar to smart glasses.
Please do not act rashly. Think before you act upon any messages (not only from this app).

Why?

  • Because I consider smart glasses an intolerable intrusion, consent neglecting, horrible piece of tech that is already used for making various and tons of equally truely disgusting 'content'. 1, 2
  • Some smart glasses feature small LED signifying a recording is going on. But this is easily disabled, whilst manufacturers claim to prevent that and take no responsibility at all (tech tends to do that for decades now). 3
  • Smart glasses have been used for instant facial recognition before 4 and reportedly will be out of the box 5. This puts a lot of people in danger.
  • I hope this app is useful for someone.

How?

  • It's a simple rather heuristic approach. Because BLE uses randomised MAC and the OSSID are not stable, nor the UUID of the service announcements, you can't just scan for the bluetooth beacons. And, to make thinks even more dire, some like Meta, for instance, use proprietary Bluetooth services and UUIDs are not persistent, we can only rely on the communicated device names for now.
  • The currently most viable approach comes from the Bluetooth SIG assigned numbers repo. Following this, the manufacturer company's name shows up as number codes in the packet advertising header (ADV) of BLE beacons.
  • this is what BLE advertising frames look like:
Frame 1: Advertising (ADV_IND)
Time:  0.591232 s
Address: C4:7C:8D:1E:2B:3F (Random Static)
RSSI: -58 dBm

Flags:
  02 01 06
    Flags: LE General Discoverable Mode, BR/EDR Not Supported

Manufacturer Specific Data:
  Length: 0x1A
  Type:   Manufacturer Specific Data (0xFF)
  Company ID: 0x058E (Meta Platforms Technologies, LLC)
  Data: 4D 45 54 41 5F 52 42 5F 47 4C 41 53 53

Service UUIDs:
  Complete List of 16-bit Service UUIDs
  0xFEAA
  • According to the Bluetooth SIG assigned numbers repo, we may use these company IDs:

    • 0x01AB for Meta Platforms, Inc. (formerly Facebook)
    • 0x058E for Meta Platforms Technologies, LLC
    • 0x0D53 for Luxottica Group S.p.A (who manufactures the Meta Ray-Bans)
    • 0x03C2 for Snapchat, Inc. (that makes SNAP Spectacles)

    They are immutable and mandatory. Of course, Meta and other manufacturers also have other products that come with Bluetooth and therefore their ID, e.g. VR Headsets. Therefore, using these company ID codes for the app's scanning process is prone to false positives. But if you can't see someone wearing an Occulus Rift around you and there are no buildings where they could hide, chances are good that it's smart glasses instead.

  • During pairing, the smart glasses usually emit their product name, so we can scan for that, too. But it's rare we will see that in the field. People with the intention to use smart glasses in bars, pubs, on the street, and elsewhere usually prepare for that beforehand.

  • When the app recognised a Bluetooth Low Energy (BLE) device with a sufficient signal strength (see RSI below), it will push an alert message. This shall help you to act accordingly.

Features

  • The app Nearby Glasses shows a notification when smart glasses are nearby (that means, a BLE device of one of those company IDs mentioned above)
  • Nearby means, the RSSI (signal strength) is less than or equal to a given value: -75 dBm by default. This default value corresponds to a medium distance and an ok-ish signal.

    What's RSSI?

  • Let me explain a bit that RSSI-Value:
    RSSI is short for Received Signal Strength Indication. The value is an indication for the reception field strength of wireless communication applications. Wikipedia has a quite good article about it. In short, RSSI depends mainly on:
    • Device transmit power
    • Antenna design
    • Walls and obstacles
    • Human bodies absorbing signal
    • Reflection and interference
    • Device orientation
      But typical BLE (Bluetooth Low Energy) scenarios, RSSI rough distance (open space) is:
    • -60 dBm ~ 1 – 3 m
    • -70 dBm ~ 3 – 10 m
    • -80 dBm ~ 10 – 20 m
    • -90 dBm ~ 20 – 40 m
    • -100 dBm ~ 30 – 100+ m or near signal loss
      Indoors, distances are often much shorter.
      RSSI drops roughly according to
      RSSI ≈ -10 * n * log10(distance) + constant
  • Therefore, the default RSSI threshold of -75 dBm corresponds to about 10 to 15 meters in open space and 3 to 10 meters indoors or in crowded spaces. You got a good chance to spot that smart glasses wearing person like that.
  • Nearby Glasses shows an optional debug log that is exportable (as txt file) and features a copy&paste function. Those are for advanced users (nerds) and for further debugging.
  • Under Settings, you may specify the log length, the debugging (display all scan items or only ADV frames).
  • You may also enter some company IDs as string of hex values, e.g. 0x01AB,0x058E,0x0D53. This overrides the built-in detection, so your notification shows up for the new value(s).
  • For better persistence, it uses Android's Foreground Service. You may disable this under Settings if you don't need it.
  • The Notification Cooldown under Settings specifies how much time must pass between two warnings. Default is 10000 ms, which is 10 s.
  • It is now a bit more localised:
    • English
    • German
    • Swiss German
    • French
    • more to come, eventually
  • Now the app icon's background is not transparent anymore
  • The edge-to-edge layout issue should be fixed with v1.0.4
  • Newly licensed under AGPL 3.0

Usage

  • See Releases for APK to download or use Google Play Store. F-Droid and/or Accrescent may follow.

Screenshot Nearby Glasses: Settings

Get It On Google Play

  1. Install the app (from Releases or from Google Play, for now) and open it
  2. Hit the Start Scanning button
  3. Grant permissions to activate Bluetooth (if not already enabled) and to access devices nearby. Some versions of Android also need you to grant permissions to access your location (before Version 13, mostly). Nearby Glasses does nothing with your location info. If you don't believe me, please look at the code
  4. if you don't see the scan starting, you might need to enable Foreground Service on your particular phone in the Settings menu (see below)
  5. You're all set! When smart glasses are detected nearby, a notification will appear. It does so until you hit Stop Scanning or terminate the app for good
  6. In the menu (top right, the cogwheel), you may make some Settings:
    1. Enable Foreground Service: By this, you prevent Android from pausing the app thus preventing it from alerting you. I recommend leaving this enabled
    2. RSSI threshold: This negative number specifies how far away a device might be to be a reason for an alert by Nearby Glasses. Technically, it referes to how strong the signal is received. Closer to zero means better signal, hence fewer distance between your phone and the smart glasses. See RSSI above for explanations and guidance. I recommend leaving it on -75
    3. Enable Notifications: You would not want to disable that
    4. Notification Cooldown: Here, you specify, how many notifications about found smart glasses nearby you want to get. I chose 10 seconds (10000 ms) as default value. Like this, you won't miss the notification while at the same time won't be bothered by it too much or drain your battery too fast
    5. Enable Log Display: Disabling this might spare you some battery
    6. Debug: Is needed to see more than just the matching BLE frames in the log display frame. It's useful to see if things are working
    7. Max log lines: How long the log may get. 200 seems to be a good balance between battery life and usability of the log (for nerds like me)
    8. BLE ADV only: This excludes other Bluetooth LE frames from the log for better readability
    9. Override Company IDs: If you want, you can let Nearby Glasses alert you of other devices than specified above. Useful for debugging, at least for me. Leave it empty if you don't need it or don't know what to do with it
    10. Every setting is saved and effective immediately. To go back, use your back button or gesture
  7. The export function enables you to share a text-file of the app's log. For nerds like me
  8. You may also copy&paste the log by tapping on the log display frame

ToDos


  • Rework to canary mode. I am looking into the suggestion I got on mastodon to steer away from warning for smart glasses and rather let the app tell there are no smart glasses found so far. This means, I must rwork the scanner logic a bit and the interface
  • Add an option to set false positives to an ignore list. Maybe in the notification?
  • I am no BT or Android expert at all. For what I've learned, one could also dig deeper into the communication of the smart glasses by sniffing the BLE traffic. By doing so, we would likely not need to rely on the device behaving according to the BT specifications but could also use heuristics on the encrypted traffic transmissions without much false positives. But I haven't looked into BT traffic packets for more than ten years. I'm glad I remembered ADV frames... So if anybody could help on this, that'd be greatly appreciated!

  • Add more manufacturers IDs of smart glasses. Right now, it's Meta, Oakley and Snap. A list of smart glasses with cameras available would help, too.
  • An iOS app might be possible, too. I have the toolchain now, but I will need a Mac to submit it to the Apple App Store in the end. And I need to dig deeper into iOS development-
  • There layout issue with Google Pixel devices seems to be fixed as of Version 1.0.3. If you still can't reach the menu as it's mixed with the status bar somehow. Will look into that asap. Meanwhile, try to put your screen to landscape mode and rotate clockwise (to the right).

Tech-Solutionism?

I know, this might be an odd place to do so, but just hear me out on this. I am aware this is a technical solution to a social problem, which is itsself amplified by tech. I do not want to promote techsolutionism nor do I want people to feel falsely secure. It's still an imperfect approach and propably always will be. It's not all good only because this app exists now. We need better solutions to curb on surveilance tech and privacy intrution.

Build from Source

As Nearby Glasses is open source, you may also build the app yourself from the source code. This makes sure there are no other libraries included in the APK and you get what you want.

Please Note This app builds upon:

  • Gradle Wrapper: 8.13
  • Android Gradle Plugin: 8.13.2
  • Kotlin: 1.9.22
  • compileSdk: 35
  • targetSdk: 35
  • minSdk: 26
  • No product flavors
  • Repositories: google() and mavenCentral() only
  • No Google Services or Firebase plugins

Requirements

  • JDK 17 (required — project targets Java 17)
  • Android SDK Platform 35 installed
    • compileSdk = 35
    • targetSdk = 35
  • Git

Building APK step-by-step

#Verify Java version:

 $java -version
#It must report Java 17.

#Get the source code
 $git clone http://github.com/yjeanrenaud/yj_nearbyglasses
 $cd yj_nearbyglasses

#Build Debug
 $./gradlew clean assembleDebug

#Build Release (with your own signature cert)
 $./gradlew clean assembleRelease

#Build unsigned Release for IzzyOnDroid / F-Droid
 $./gradlew clean izziFdroid 

#Run and Test
 $./gradlew test lint

Shoutouts

License and Credits

App Icon: The icon is based on Eyeglass icons created by Freepik - Flaticon
License: This app Nearby Glasses is licensed under the AGPL-3.0 license.