{"id":43795748,"url":"https://github.com/inovait/neatle","last_synced_at":"2026-02-05T21:05:57.782Z","repository":{"id":57742992,"uuid":"81201370","full_name":"inovait/neatle","owner":"inovait","description":"A Neat BluetoothLE library for Android","archived":false,"fork":false,"pushed_at":"2023-10-06T05:48:21.000Z","size":370,"stargazers_count":44,"open_issues_count":11,"forks_count":13,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-10-21T04:11:23.596Z","etag":null,"topics":["android","bluetooth","btle"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inovait.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-02-07T11:34:21.000Z","updated_at":"2025-07-30T14:37:24.000Z","dependencies_parsed_at":"2023-02-10T22:45:56.111Z","dependency_job_id":null,"html_url":"https://github.com/inovait/neatle","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/inovait/neatle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inovait%2Fneatle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inovait%2Fneatle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inovait%2Fneatle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inovait%2Fneatle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inovait","download_url":"https://codeload.github.com/inovait/neatle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inovait%2Fneatle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29134280,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T20:50:26.975Z","status":"ssl_error","status_checked_at":"2026-02-05T20:49:26.082Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["android","bluetooth","btle"],"created_at":"2026-02-05T21:05:48.375Z","updated_at":"2026-02-05T21:05:54.514Z","avatar_url":"https://github.com/inovait.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NeatLE\n\nNeatLE is an Android BTLE (Bluetooth low energy) support library that simplifies management of BTLE connections, subscriptions, devices and operations.\nIt provides a single entry point for all BTLE related operations.\n\n## Features\n * Monitor a connection to a BTLE device.\n * Send read / write commands and receive responses.\n * Subscribe to characteristics and get notified of changes.\n\n## Installation\n\nInclude the NeatLE library in your Android project as a Gradle dependency:\n```groovy\ndependencies {\n    compile 'si.inova:neatle:X.Y.Z'\n}\n```\n\nReplace `X.Y.Z` above with latest version: ![Maven Central](https://img.shields.io/maven-central/v/si.inova/neatle)\n\n## Examples\n\n### Scan for nearby devices\n\n`Scanner` can be used to scan for all nearby BTLE devices that advertise specific service.\n\n```java\nif (ContextCompat.checkSelfPermission(context,\n        Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n    // We cannot scan as we do not have location permission\n    // TODO notify user\n\n    return;\n}\n\n// Scan for devices that can report battery status\nUUID batteryService = Neatle.createUUID(0x180f);\n\nScanBuilder builder = Neatle.createScannerBuilder();\nbuilder.addServiceUUID(batteryService);\n\nbuilder.setNewDeviceFoundListener(new Scanner.NewDeviceFoundListener() {\n    @Override\n    public void onNewDeviceFound(ScanEvent e) {\n        System.out.println(\"Device \" + e.getDevice() + \" found!\");\n    }\n});\n\nscanner = builder.build();\nscanner.startScanning(context);\n\n...\n\nscanner.stopScanning();\n```\n\n### Monitor for connections:\n\nA `ConnectionMonitor` tries to connect to a specific BTLE device, and if configured with `setKeepAlive(true)`, will try to maintain that connection until the monitor is stopped.\nThe `ConnectionStateListener` will be notified of any changes to the connection, (e.g. device connected / disconnected).\n\n```java\nConnectionMonitor monitor =\n        Neatle.createConnectionMonitor(context, Neatle.getDevice(\"00:11:22:33:44:55\"));\nmonitor.setOnConnectionStateListener(new ConnectionStateListener() {\n    @Override\n    public void onConnectionStateChanged(Connection connection, int newState) {\n        if(connection.isConnected()){\n            // The device has connected\n        }\n    }\n});\nmonitor.start();\n```\n\n\n### Create an operation:\n\nAn `Operation` is a series of read / write commands that can be executed for a specific BTLE device.\nIt can have multiple read **and** write operations, that will be executed on the device sequentially.\n\nAn operation can also be executed more than once.\n\n#### Read operation\n\n```java\nBluetoothDevice device = Neatle.getDevice(\"00:11:22:33:44:55\");\nUUID batteryService = Neatle.createUUID(0x180f);\nfinal UUID batteryCharacteristic = Neatle.createUUID(0x2a19);\n\nOperation operation = Neatle.createOperationBuilder(context)\n        .read(batteryService, batteryCharacteristic)\n        .onFinished(new SimpleOperationObserver() {\n            @Override\n            public void onOperationFinished(Operation op, OperationResults results) {\n                if(results.wasSuccessful()){\n                    int battery = results.getResult(batteryCharacteristic).getValueAsInt();\n                }\n            }\n        })\n        .build(device);\noperation.execute();\n```\n\n#### Write operation\n\n```java\nBluetoothDevice device = Neatle.getDevice(\"00:11:22:33:44:55\");\nUUID serviceToWrite = ...\nfinal UUID characteristicToWrite = ...\nbyte[] dataToWrite = ...\n\nInputSource inputSource = new ByteArrayInputSource(dataToWrite);\n\nOperation operation = Neatle.createOperationBuilder(context)\n        .write(serviceToWrite, characteristicToWrite, inputSource)\n        .onFinished(new SimpleOperationObserver() {\n            @Override\n            public void onOperationFinished(Operation op, OperationResults results) {\n                if (results.wasSuccessful()) {\n                    System.out.println(\"Write was successful!\");\n                } else {\n                    System.out.println(\"Write failed! \");\n                }\n            }\n        })\n        .build(device);\noperation.execute();\n```\n\n### Create a subscription:\n\nA `Subscription` listens for notification events on a specific service for a specific characteristic on the BTLE device, and reports them back to the caller.\n```java\nBluetoothDevice device = Neatle.getDevice(\"00:11:22:33:44:55\");\nUUID batteryService = Neatle.createUUID(0x180f);\nUUID batteryCharacteristic = Neatle.createUUID(0x2a19);\n\nCharacteristicSubscription subscription =\n        Neatle.createSubscription(context, device, batteryService, batteryCharacteristic);\nsubscription.setOnCharacteristicsChangedListener(new CharacteristicsChangedListener() {\n    @Override\n    public void onCharacteristicChanged(CommandResult change) {\n        if (change.wasSuccessful()) {\n            int batteryLevel = change.getValueAsInt();\n        }\n    }\n});\nsubscription.start();\n```\nNote: An active subscription will keep a `ConnectionMonitor` with `setKeepAlive(false)` (the default setting) alive.\n\n## Permissions\n\nThe following permission are required by NeatLE (and are already defined in it's manifest):\n\n```xml\n\u003cuses-permission android:name=\"android.permission.BLUETOOTH\" /\u003e\n\u003cuses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\" /\u003e\n\u003cuses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" /\u003e\n```\nThe `ACCESS_COARSE_LOCATION` permission is considered *dangerous* on Android 6.0 (23) and up, and should be requested manually by the developer, before running NeatLE.\n\n\n## License\n\n    MIT License\n    \n    Copyright (c) 2017 Inova IT\n    \n    Permission is hereby granted, free of charge, to any person obtaining a copy\n    of this software and associated documentation files (the \"Software\"), to deal\n    in the Software without restriction, including without limitation the rights\n    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n    copies of the Software, and to permit persons to whom the Software is\n    furnished to do so, subject to the following conditions:\n    \n    The above copyright notice and this permission notice shall be included in all\n    copies or substantial portions of the Software.\n    \n    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n    SOFTWARE.`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finovait%2Fneatle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finovait%2Fneatle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finovait%2Fneatle/lists"}