{"id":21333854,"url":"https://github.com/nexenio/ble-indoor-positioning","last_synced_at":"2025-04-05T14:06:35.498Z","repository":{"id":51110425,"uuid":"110686293","full_name":"neXenio/BLE-Indoor-Positioning","owner":"neXenio","description":"Multilateration using bluetooth beacons","archived":false,"fork":false,"pushed_at":"2020-07-02T07:48:12.000Z","size":1846,"stargazers_count":438,"open_issues_count":28,"forks_count":129,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-03-29T13:08:14.031Z","etag":null,"topics":["beacon","bluetooth","indoor-positioning","java","library","multilateration","trilateration"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neXenio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-14T12:16:43.000Z","updated_at":"2025-03-10T04:00:30.000Z","dependencies_parsed_at":"2022-09-13T14:11:52.324Z","dependency_job_id":null,"html_url":"https://github.com/neXenio/BLE-Indoor-Positioning","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neXenio%2FBLE-Indoor-Positioning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neXenio%2FBLE-Indoor-Positioning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neXenio%2FBLE-Indoor-Positioning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neXenio%2FBLE-Indoor-Positioning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neXenio","download_url":"https://codeload.github.com/neXenio/BLE-Indoor-Positioning/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247345852,"owners_count":20924102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beacon","bluetooth","indoor-positioning","java","library","multilateration","trilateration"],"created_at":"2024-11-21T23:16:28.892Z","updated_at":"2025-04-05T14:06:35.472Z","avatar_url":"https://github.com/neXenio.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Travis](https://img.shields.io/travis/neXenio/BLE-Indoor-Positioning/master.svg)](https://travis-ci.org/neXenio/BLE-Indoor-Positioning/builds) [![GitHub release](https://img.shields.io/github/release/neXenio/BLE-Indoor-Positioning.svg)](https://github.com/neXenio/BLE-Indoor-Positioning/releases) [![JitPack](https://img.shields.io/jitpack/v/neXenio/BLE-Indoor-Positioning.svg)](https://jitpack.io/#neXenio/BLE-Indoor-Positioning/) [![Codecov](https://img.shields.io/codecov/c/github/nexenio/BLE-Indoor-Positioning.svg)](https://codecov.io/gh/neXenio/BLE-Indoor-Positioning) [![license](https://img.shields.io/github/license/neXenio/BLE-Indoor-Positioning.svg)](https://github.com/neXenio/BLE-Indoor-Positioning/blob/master/LICENSE)\n\n# BLE Indoor Positioning\n\nThis repo contains a [Java library][package_core] that is capable of estimating locations based on advertising packets received from Bluetooth beacons. It also contains an [Android app][package_app] that uses this library to visualize beacon and location data.\n\n![Demo App Screen Recording](https://raw.githubusercontent.com/wiki/neXenio/BLE-Indoor-Positioning/images/demo-app/demo_app.gif)\n\n# Usage\n\n## Integration\n\n#### Gradle\n\nRelease artefacts are available through [Bintray][bintray].\n\n```groovy\ndependencies {\n    compile 'com.nexenio.bleindoorpositioning:core:0.4.0'\n}\n```\n\nIf you want to use branch snapshots or specific commits, use [JitPack][jitpack].\n\n```groovy\nallprojects {\n    repositories {\n        maven { url 'https://jitpack.io' }\n    }\n}\n\ndependencies {\n    compile 'com.github.neXenio:BLE-Indoor-Positioning:dev-SNAPSHOT'\n}\n```\n\n#### Maven\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.nexenio.bleindoorpositioning\u003c/groupId\u003e\n  \u003cartifactId\u003ecore\u003c/artifactId\u003e\n  \u003cversion\u003e0.4.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n#### JAR\nYou can download the latest `.jar` files from [GitHub][releases] or [Bintray][bintray].\n\n## Bluetooth Scanning\n\nYou need to implement some sort of Bluetooth scanning in order to get the advertising data from nearby beacons. On Android, you can use the [BluetoothAdapter][androidbluetoothle] or libraries like [RxAndroidBle][rxandroidble] that wrap around the system APIs.\n\nYou'll get a scan result, which you can extract the beacon mac address and raw advertising data from. Forward that data to the `BeaconManager` singleton and it will take care of everything else.\n\n```Java\nprivate void processScanResult(ScanResult scanResult) {\n    String macAddress = scanResult.getBleDevice().getMacAddress();\n    byte[] advertisingData = scanResult.getScanRecord().getBytes();\n    int rssi = scanResult.getRssi();\n    BeaconManager.processAdvertisingData(macAddress, advertisingData, rssi);\n}\n```\n\nThe `BeaconManager` will create `Beacon` instances for you and hold them in memory. Each `Beacon` will hold a list of recent `AdvertisingPackets`. There are quite a few convenience methods for Eddystone and iBeacon available, too.\n\nYou can listen for beacon changes by registering a `BeaconUpdateListener`:\n\n```Java\nBeaconManager.registerBeaconUpdateListener(new BeaconUpdateListener() {\n    @Override\n    public void onBeaconUpdated(Beacon beacon) {\n        // have fun with your beacon!\n    }\n});\n```\n\nFor some more fine-tuned callbacks, you may want to use a `FilteredBeaconUpdateListener`, which will only emit updates when beacons match a `BeaconFilter` of your choice.\n\n## Distance Estimation\n\nBased on the received `AdvertisingPackets` (which also keep track of the [RSSIs][rssi]), you can get an estimated distance (in meters) to each Beacon. Simply call `beacon.getDistance()` or directly use the `BeaconDistanceCalculator`, which operates using the [Log-distance path loss model][log_distance_path_loss_model].\n\n## Location Estimation\n\nBased on the estimated distances to nearby beacons, the `IndoorPositioning` singleton can calculate the current geo coordinates of the device that received the advertising data. It utilizes the `Multilateration` class for that, which solves  a formulation of n-D space trilateration problem with a nonlinear least squares optimizer (using the [Levenberg–Marquardt algorithm][levenberg_marquardt_algorithm]).\n\nYou can listen for location changes by registering a `LocationListener`:\n\n```Java\nIndoorPositioning.registerLocationListener(new LocationListener() {\n    @Override\n    public void onLocationUpdated(LocationProvider locationProvider, Location location) {\n        // have fun with your location!\n    }\n});\n```\n\nThe `Location` will contain latitude, longitude and altitude, as well as some convenience methods to get the distance or angle to a different location.\n\n\u003e This assumes that the geo coordinates of the beacons are known. You can assign a `BeaconLocationProvider` to any beacon instance, which could read the geo coordinates from the advertising data or some external API.\n\n[releases]: https://github.com/neXenio/BLE-Indoor-Positioning/releases\n[jitpack]: https://jitpack.io/#neXenio/BLE-Indoor-Positioning/\n[bintray]: https://bintray.com/nexenio/BLE-Indoor-Positioning\n[package_core]: https://github.com/neXenio/BLE-Indoor-Positioning/tree/master/BLE%20Indoor%20Positioning/src/main/java/com/nexenio/bleindoorpositioning\n[package_app]: https://github.com/neXenio/BLE-Indoor-Positioning/tree/master/app/src/main/java/com/nexenio/bleindoorpositioningdemo\n[rxandroidble]: https://github.com/Polidea/RxAndroidBle\n[androidbluetoothle]: https://developer.android.com/guide/topics/connectivity/bluetooth-le.html\n[rssi]: https://en.wikipedia.org/wiki/Received_signal_strength_indication\n[log_distance_path_loss_model]: https://en.wikipedia.org/wiki/Log-distance_path_loss_model\n[levenberg_marquardt_algorithm]: https://en.wikipedia.org/wiki/Levenberg%E2%80%93Marquardt_algorithm\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnexenio%2Fble-indoor-positioning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnexenio%2Fble-indoor-positioning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnexenio%2Fble-indoor-positioning/lists"}