{"id":3530,"url":"https://github.com/algolia/voice-overlay-android","last_synced_at":"2025-06-19T15:43:01.939Z","repository":{"id":33510116,"uuid":"139958370","full_name":"algolia/voice-overlay-android","owner":"algolia","description":"🗣 An overlay that gets your user’s voice permission and input as text in a customizable UI","archived":false,"fork":false,"pushed_at":"2022-04-05T15:16:01.000Z","size":40369,"stargazers_count":258,"open_issues_count":5,"forks_count":36,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-25T11:53:23.237Z","etag":null,"topics":["android","chatbots","conversation","conversational-bots","conversational-interface","conversational-ui","input","instant-search","instantsearch","overlay","permission","permissions","permissions-android","search","speech-recognition","speech-to-text","stt","voice","voice-assistant","voice-recognition"],"latest_commit_sha":null,"homepage":"https://alg.li/voice","language":"Kotlin","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/algolia.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}},"created_at":"2018-07-06T08:46:17.000Z","updated_at":"2025-04-03T19:44:50.000Z","dependencies_parsed_at":"2022-08-07T22:00:27.745Z","dependency_job_id":null,"html_url":"https://github.com/algolia/voice-overlay-android","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/algolia/voice-overlay-android","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algolia%2Fvoice-overlay-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algolia%2Fvoice-overlay-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algolia%2Fvoice-overlay-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algolia%2Fvoice-overlay-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/algolia","download_url":"https://codeload.github.com/algolia/voice-overlay-android/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algolia%2Fvoice-overlay-android/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260781566,"owners_count":23062258,"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","chatbots","conversation","conversational-bots","conversational-interface","conversational-ui","input","instant-search","instantsearch","overlay","permission","permissions","permissions-android","search","speech-recognition","speech-to-text","stt","voice","voice-assistant","voice-recognition"],"created_at":"2024-01-05T20:16:44.121Z","updated_at":"2025-06-19T15:42:56.910Z","avatar_url":"https://github.com/algolia.png","language":"Kotlin","readme":"![Voice Overlay for Android](./docs/banner.png)\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://img.shields.io/badge/platform-Android-blue.svg?style=flat\" alt=\"Platform Android\" /\u003e\n\u003ca href=\"./LICENSE\"\u003e\u003cimg src=\"http://img.shields.io/badge/license-MIT-blue.svg?style=flat\" alt=\"License: MIT\" /\u003e\u003c/a\u003e\n\u003cimg src=\"https://img.shields.io/badge/Android%20Arsenal-Voice%20Overlay-green.svg?style=flat\" alt=\"Android Arsenal\" /\u003e\n\u003c/p\u003e\n\n# Overview\n\n**Voice overlay** helps you turn your user's **voice** into **text**, providing a **polished UX** while handling for you the **necessary permission**.\n\n\u003cp float=\"left\"\u003e\n  \u003cimg src=\"./docs/permission.jpg\" width=\"200\" /\u003e\n  \u0026nbsp;\n  \u003cimg src=\"./docs/listen.gif\" width=\"200\" /\u003e\n  \u0026nbsp;\n  \u003cimg src=\"./docs/speak.gif\" width=\"200\" /\u003e\n  \u0026nbsp;\n  \u003cimg src=\"./docs/nopermission.jpg\" width=\"200\" /\u003e\n  \u0026nbsp;\n\u003c/p\u003e\n\n# Demo\n\nYou can clone this repo, then run the Demo project by doing `./gradlew app:installDebug` and launching the application:\n\n\u003cimg src=\"./docs/demo.gif\" width=\"250\"\u003e\n\n# Installation\n\nThe Voice overlay is available as a gradle dependency via [JCenter](https://bintray.com/bintray/jcenter). To install\nit, add the following line to your app's `build.gradle`:\n\n```groovy\ndependencies {\n    // [...]\n    implementation 'com.algolia.instantsearch:voice:1.0.0-beta02'\n    // [...]\n}\n```\n\n\n# Usage\n\n## Basic usage\n1. In your Activity, check if you have the permission and show the appropriate `Dialog`:\n```kotlin\nif (!isRecordAudioPermissionGranted()) {\n    VoicePermissionDialogFragment().show(supportFragmentManager, \"DIALOG_PERMISSION\")\n} else {\n    VoiceInputDialogFragment().show(supportFragmentManager, \"DIALOG_INPUT\")\n}\n```\n_See [it implemented in the demo app](app/src/main/kotlin/com/algolia/instantsearch/voice/demo/MainActivity.kt#L26-L30)._\n\nThis will display the permission dialog if the `RECORD_AUDIO` permission was not yet granted, then the voice input dialog once the permission is granted.\n\nOnce the user speaks, you will get their input back by implementing `VoiceSpeechRecognizer.ResultsListener`:\n```kotlin\noverride fun onResults(possibleTexts: Array\u003cout String\u003e) {\n    // Do something with the results, for example:\n    resultView.text = possibleTexts.firstOrNull()?.capitalize()\n}\n```\n_See [it implemented in the demo app](app/src/main/kotlin/com/algolia/instantsearch/voice/demo/MainActivity.kt#L41-L43)._\n\n## When the permission is not granted\n\nIf the user didn't accept the permission, you [should explain](https://developer.android.com/training/permissions/requesting#explain) the permission's rationale. If they deny the permission, you need to guide them into manually enabling it if they want to use the voice-input feature. \n\nVoice overlay makes it easy to handle all these cases:\n\n```groovy\noverride fun onRequestPermissionsResult(requestCode: Int, permissions: Array\u003cout String\u003e, grantResults: IntArray) {\n    super.onRequestPermissionsResult(requestCode, permissions, grantResults)\n    if (Voice.isRecordPermissionWithResults(requestCode, grantResults)) {\n        when {\n            Voice.isPermissionGranted(grantResults) -\u003e showVoiceDialog()\n                shouldExplainPermission() -\u003e showPermissionRationale(getPermissionView())\n                else -\u003e Voice.showPermissionManualInstructions(getPermissionView())\n        }\n    }\n    // [...] eventual handling of other permissions requested by your app \n}\n```\n_See [it implemented in the demo app](app/src/main/kotlin/com/algolia/instantsearch/voice/demo/MainActivity.kt#L42-L51)._\n\nThis will display the permission rationale when the user doesn't allow it, and the manual instructions in case they denied it.\n\n## Customization\nYou can customize your voice overlay in the following ways:\n\n### Behavior\nSeveral options let you adapt the voice overlay\\'s behavior to your needs.\n\n#### Suggestions\nYou can provide suggestions of what the user could say, to give them some examples. \n```kotlin\nvoiceInputDialogFragment.setSuggestions(\n    \"64GB Smartphone\",\n    \"Red running shoes\",\n    \"Cheap TV screen\"\n)\n```\n\n#### AutoStart\nYou can prevent the overlay from automatically listening to user input.\n```kotlin\n/// Requires the user to click the mic to start listening. \nvoiceInputDialogFragment.autoStart = false\n// [...]\n// you can also start listening programmatically with\nvoiceInputDialogFragment.start()\n```\n\n\n### Copy text\n\nYou can change any text displayed in the overlay by overriding its resource in your `strings.xml`:\n```xml\n\u003c!-- VoiceInputDialogFragment --\u003e\n\u003cstring name=\"input_title_listening\"\u003eListening…\u003c/string\u003e\n\u003cstring name=\"input_subtitle_listening\"\u003eSay something like:\u003c/string\u003e\n\u003cstring name=\"input_title_error\"\u003eSorry, we didn\\'t quite get that.\u003c/string\u003e\n\u003cstring name=\"input_subtitle_error\"\u003eTry repeating your request.\u003c/string\u003e\n\u003cstring name=\"input_hint_error\"\u003eTry again\u003c/string\u003e\n\n\u003c!-- VoicePermissionDialogFragment --\u003e\n\u003cstring name=\"permission_title\"\u003eYou can use voice search to find products.\u003c/string\u003e\n\u003cstring name=\"permission_subtitle\"\u003eMay we access your device’s microphone to enable voice search?\u003c/string\u003e\n\u003cstring name=\"permission_button_allow\"\u003eAllow microphone access\u003c/string\u003e\n\u003cstring name=\"permission_button_reject\"\u003eNo\u003c/string\u003e\n\n\u003c!-- Rationale/Try Again --\u003e\n\u003cstring name=\"permission_rationale\"\u003eVoice search requires this permission.\u003c/string\u003e\n\u003cstring name=\"permission_button_again\"\u003eRequest again?\u003c/string\u003e\n\n\u003c!-- Manual Instructions --\u003e\n\u003cstring name=\"permission_enable_rationale\"\u003ePermission denied, allow it to use voice search.\u003c/string\u003e\n\u003cstring name=\"permission_button_enable\"\u003eAllow recording\u003c/string\u003e\n\u003cstring name=\"permission_enable_instructions\"\u003eOn the next screen, tap Permissions then Microphone.\u003c/string\u003e\n```\n### Layouts\n\nYou can replace the voice overlay's layouts by your own, as long as they respect the following structure:\n\n#### Permission\n\nCreate a layout called `voice_input.xml` with\n- A `ViewGroup` container with id `@+id/voicePermission`\n- A `View` with id `@+id/close` for closing the overlay when clicked\n- A `TextView` with id `@+id/title`\n- A `TextView` with id `@+id/subtitle`\n\n#### Input\n\nCreate a layout called `voice_permission.xml` with\n- A `ViewGroup` container with id `@+id/voiceInput`\n- A `VoiceMicrophone` with id `@+id/microphone` to handle the voice input\n- A `TextView` with id `@+id/suggestions` to display eventual suggestions\n- A `View` with id `@+id/close` for closing the overlay when clicked\n- A `TextView` with id `@+id/title`\n- A `TextView` with id `@+id/subtitle`\n- An eventual `TextView` with id `@+id/hint` to display a hint on error\n- An eventual `RippleView` with id `@+id/ripple` if you want to keep the animation\n\n## Getting Help\n\n- **Need help**? Ask a question to the [Algolia Community](https://discourse.algolia.com/) or on [Stack Overflow](http://stackoverflow.com/questions/tagged/algolia).\n- **Found a bug?** You can open a [GitHub issue](https://github.com/algolia/voice-overlay-android/issues/new).\n- **Questions about Algolia?** You can search our [FAQ in our website](https://www.algolia.com/doc/faq/).\n\n\n## Getting involved\n\n* If you **want to contribute** please feel free to [**submit pull requests**](https://github.com/algolia/voice-overlay-android/pull/new).\n* If you **have a feature request** please [**open an issue**](https://github.com/algolia/voice-overlay-android/issues/new).\n* If you use the **Voice Overlay** in your app, we would love to hear about it! Drop us a line on [discourse](https://discourse.algolia.com/) or [twitter](https://twitter.com/algolia).\n\n## License\n\nThe VoiceOverlay is available under the MIT license. See the [LICENSE file](./LICENSE) for more info.\n","funding_links":[],"categories":["Libraries","Index"],"sub_categories":["GUI"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falgolia%2Fvoice-overlay-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falgolia%2Fvoice-overlay-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falgolia%2Fvoice-overlay-android/lists"}