{"id":13480888,"url":"https://github.com/androidthings/sample-button","last_synced_at":"2025-03-27T11:31:05.048Z","repository":{"id":97075378,"uuid":"76376198","full_name":"androidthings/sample-button","owner":"androidthings","description":"Basic input and output using a button and LED","archived":false,"fork":false,"pushed_at":"2021-05-26T17:55:21.000Z","size":7867,"stargazers_count":104,"open_issues_count":1,"forks_count":66,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-10-30T14:42:41.506Z","etag":null,"topics":["android-things"],"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/androidthings.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-12-13T16:13:59.000Z","updated_at":"2023-07-11T06:31:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"b74311c2-26c3-4b7c-8fe1-f4658cf851e0","html_url":"https://github.com/androidthings/sample-button","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androidthings%2Fsample-button","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androidthings%2Fsample-button/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androidthings%2Fsample-button/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androidthings%2Fsample-button/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/androidthings","download_url":"https://codeload.github.com/androidthings/sample-button/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245836040,"owners_count":20680309,"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":["android-things"],"created_at":"2024-07-31T17:00:46.266Z","updated_at":"2025-03-27T11:31:04.495Z","avatar_url":"https://github.com/androidthings.png","language":"Java","funding_links":[],"categories":["Useful links"],"sub_categories":["Sample apps and libraries"],"readme":"# Button and LED\n\nThis Android Things sample demonstrates how to use a button input\nUserDriver to listen to GPIO pin changes, generate and listen for key events\nand change the state of an LED accordingly.\n\n\u003e **Note:** The Android Things Console will be turned down for non-commercial\n\u003e use on January 5, 2022. For more details, see the\n\u003e [FAQ page](https://developer.android.com/things/faq).\n\n## Screenshots\n\n![Button sample demo][demo-gif]\n\n[(Watch the demo on YouTube)][demo-yt]\n\n## Pre-requisites\n\n- Android Things compatible board\n- Android Studio 2.2+\n- [Rainbow HAT for Android Things](https://shop.pimoroni.com/products/rainbow-hat-for-android-things) or the following individual components:\n    - 1 LED\n    - 1 push button\n    - 2 resistors\n    - jumper wires\n    - 1 breadboard\n\n## Schematics\n\nIf you have the Raspberry Pi [Rainbow HAT for Android Things](https://shop.pimoroni.com/products/rainbow-hat-for-android-things), just plug it onto your Raspberry Pi 3.\n\n![Schematics for Raspberry Pi 3](rpi3_schematics.png)\n\n## Build and install\n\nOn Android Studio, click on the \"Run\" button.\n\nIf you prefer to run on the command line, type\n\n```bash\n./gradlew installDebug\nadb shell am start com.example.androidthings.button/.ButtonActivity\n```\n\nIf you have everything set up correctly, the LED will light up when you press\nthe button and light off when you release it.\n\n## Enable auto-launch behavior\n\nThis sample app is currently configured to launch only when deployed from your\ndevelopment machine. To enable the main activity to launch automatically on boot,\nadd the following `intent-filter` to the app's manifest file:\n\n```xml\n\u003cactivity ...\u003e\n\n    \u003cintent-filter\u003e\n        \u003caction android:name=\"android.intent.action.MAIN\"/\u003e\n        \u003ccategory android:name=\"android.intent.category.HOME\"/\u003e\n        \u003ccategory android:name=\"android.intent.category.DEFAULT\"/\u003e\n    \u003c/intent-filter\u003e\n\n\u003c/activity\u003e\n```\n\n## License\n\nCopyright 2016 The Android Open Source Project, Inc.\n\nLicensed to the Apache Software Foundation (ASF) under one or more contributor\nlicense agreements.  See the NOTICE file distributed with this work for\nadditional information regarding copyright ownership.  The ASF licenses this\nfile to you under the Apache License, Version 2.0 (the \"License\"); you may not\nuse this file except in compliance with the License.  You may obtain a copy of\nthe License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\nWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the\nLicense for the specific language governing permissions and limitations under\nthe License.\n\n[demo-yt]: https://www.youtube.com/watch?v=hKmPZryY_Qc\u0026index=3\u0026list=PLWz5rJ2EKKc-GjpNkFe9q3DhE2voJscDT\n[demo-gif]: demo1.gif\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandroidthings%2Fsample-button","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandroidthings%2Fsample-button","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandroidthings%2Fsample-button/lists"}