Skip to content

Integration Guide: Android

brhackle edited this page Dec 12, 2025 · 2 revisions

Bad Elf Product Compatibility w/ Android

Model Name SKU Bluetooth USB Configuration & FW Updates
Bad Elf Flex Mini BE-GPS-2500,
BE-GPS-3500
NMEA (out)
RTCM (in)
NMEA (out)
RTCM (in)
Flex app (iOS/Android)
Config via NMEA
Bad Elf Flex BE-GPS-5500,
BE-GPS-6500
NMEA (out)
RTCM (in)
NMEA (out)
RTCM (in)
Flex app (iOS/Android)
USB key w/ OTG adapter
Legacy/EOL Models:
Bad Elf GNSS Surveyor BE-GPS-3300 NMEA (out) --- USB FAT drive mode
Bad Elf GPS app (iOS)
Bad Elf Pro+ BE-GPS-2300 NMEA (out) --- USB FAT drive mode
Bad Elf GPS app (iOS)
Bad Elf Pro BE-GPS-2200 NMEA (out) --- Bad Elf GPS app (iOS)

Connectivity with Bad Elf GNSS receivers

Bad Elf's external GNSS receivers can be connected to Android phones/tablets via:

  • Bluetooth: the user must first complete the pairing process via the standard Android Bluetooth settings screen. This creates a pairing record that can be used for all future connections. Pairings can be "forgotten" by either side, in which case the user will need to pair again.

  • USB cable: the user turns on the Bad Elf GNSS receiver and connects it to the Android device via direct USB-C cable, an OTG adapter, or USB hub.

Once paired via Bluetooth or connected via USB cable, your app can access the external GNSS receiver in one of two ways:

  1. Configure the Android Mock Location provider interface, and access position updates from via Android Location SDK. This interface supports the internal GPS (if installed) and external GNSS hardware, but requires multi-step configuration by the end user.
  2. Use Android Bluetooth SDK or USB SDK to open a connection directly to the Bad Elf GNSS receiver and receive the NMEA position feed. This can be automated to provide a great user experience.

Most Android apps will use both methods, allowing them to switch between the internal GNSS receiver and external GNSS receivers.

1. Mock Location and Android Location APIs

Android provides Location APIs for any location-based app to request position updates after prompting for the user's permission. For phones and tablets with an internal GPS receiver, the device manufacturer typically provides a device driver that will make the GPS data available via Location APIs by default. If a GPS signal isn't available, Android will provide less-precise location data based on Wi-Fi or cell tower triangulation.

To use Bad Elf GNSS receivers via the Location API, the end-user must configure Android's mock location interface which designates an app that will bridge between the Bluetooth/USB connection and the Location APIs.

The Bad Elf Flex app provides this functionality for the Bad Elf Flex Mini (2500/3500) and Flex (5500/6500) receivers connected over Bluetooth or USB.

For legacy Bad Elf GPS receivers (2200/2300/3300), you can use a free and open-source app called Bluetooth GNSS.

Instructions for configuring the mock location provider interface can be found here.

In the case where you have multiple Android apps that need position data from the Bad Elf GNSS receiver at the same time, this interface is often the best choice.

2. Direct Connectivity via Bluetooth or USB APIs

To use access the NMEA feed directly from the GNSS receiver, one (and only one) app can open the Bluetooth and/or USB connection. In the case of USB, the connection will open immediately and start streaming valid NMEA by default. But in the case of Bluetooth, it may takes 5-20s for the Bluetooth RFCOMM connection to be opened, or timeout if the GNSS receiver is not in range or powered on.

Best Practices

The Bluetooth or USB connection is controlled and owned exclusively by your app. Android provides the Bluetooth pairing record and permissions checks, but everything else is up to you -- first connection, re-connects, etc.

Your app must gracefully handle the following common scenarios:

  • The Bluetooth interface may have be turned OFF by the user
  • You may find Bluetooth pairing records for 0, 1 or up to a dozen Bad Elf GNSS receivers
  • The Bluetooth connection takes 5-20 seconds to be established, or times out completely
  • The Bluetooth or USB connection may be in use by another app
  • The USB or Bluetooth connection disappears suddenly (cable unplugged, Bluetooth goes out of range, Bluetooth turned OFF by the user, etc)
  • At the end of the day, the user will power off their GNSS receiver and put the phone/tablet away, and likely not "shut everything down cleanly". If your app has reconnect logic, be respectful of their battery life!

Your user likely has multiple apps they use with their external GNSS receiver. Implementing logic to automatically re-open the Bluetooth connection on app launch, or perdiocally attempting to re-open a dropped connection, can provide a great user experience. However, you app should provide an a simple way for the user to disable this logic in the case where they might be switching between data collection apps and don't want your app to get in the way.

The Bad Elf Flex app uses a hidden Bluetooth RFCOMM profile to connect the Flex or Flex Mini hardware, so it won't conflict with your app's use of the default public RFCOMM channel.

The Bad Elf Flex app will automatically open the USB connection to a Flex Mini when it's available, but this can be disabled in the Flex app settings.