{"id":19173870,"url":"https://github.com/navideck/universal-volume","last_synced_at":"2025-08-29T05:11:55.329Z","repository":{"id":182772349,"uuid":"643928020","full_name":"Navideck/Universal-Volume","owner":"Navideck","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-10T18:16:54.000Z","size":347,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-23T00:39:19.278Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://navideck.github.io/Universal-Volume","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/Navideck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"dei":null},"funding":{"github":"navideck"}},"created_at":"2023-05-22T12:54:35.000Z","updated_at":"2023-07-25T06:37:11.000Z","dependencies_parsed_at":"2024-02-10T19:28:36.385Z","dependency_job_id":"e333ebf9-e0ef-481e-a021-02a7af24d833","html_url":"https://github.com/Navideck/Universal-Volume","commit_stats":null,"previous_names":["navideck/universal-volume"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Navideck/Universal-Volume","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Navideck%2FUniversal-Volume","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Navideck%2FUniversal-Volume/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Navideck%2FUniversal-Volume/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Navideck%2FUniversal-Volume/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Navideck","download_url":"https://codeload.github.com/Navideck/Universal-Volume/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Navideck%2FUniversal-Volume/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272632335,"owners_count":24967230,"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","status":"online","status_checked_at":"2025-08-29T02:00:10.610Z","response_time":87,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-09T10:15:03.046Z","updated_at":"2025-08-29T05:11:55.304Z","avatar_url":"https://github.com/Navideck.png","language":"Kotlin","funding_links":["https://github.com/sponsors/navideck"],"categories":[],"sub_categories":[],"readme":"# Universal Volume\n[![](https://jitpack.io/v/Navideck/Universal-Volume.svg)](https://jitpack.io/#Navideck/Universal-Volume)\n\nUniversal Volume is a powerful Android library that facilitates volume control for common Android devices (phones and tablets) and exotic Android devices such as **car head units**.\nIt simplifies the process of managing volume levels across different devices and provides a straightforward API to interact with the AudioManager's STREAM_MUSIC.\n\n## Features\n- Wide range of supported devices\n- Unified volume range\n- Background volume control\n\n### Supported devices\n- Generally available Android phones and tablets (e.g. Samsung, Xiaomi, Oppo etc.)\n- Jancar head units. Those device use non-standard volume APIs and come under multiple brands (e.g. Rimoody)\n\n### Unified volume range\nSome devices may have varying volume ranges, such as 0 to 15 or 0 to 30. Universal Volume makes this range consistent across devices.\n\n### Background volume control\n- Universal Volume works seamlessly when your app is in the background. Devices from Oppo, Vivo, and Realme require special workarounds to support background `STREAM_MUSIC` volume control. Universal Volume takes care of that.\n\n## Installation\n\nTo include Universal Volume in your Android project, add the JitPack repository to your `settings.gradle` at the end of repositories:\n\n```gradle\ndependencyResolutionManagement {\n    ...\n    repositories {\n        ...\n        maven { url 'https://jitpack.io' }  // Adding JitPack as dependencies source\n    }\n}\n```\n\nAdd the dependency in your app's `build.gradle`:\n \n```gradle\ndependencies {\n    ...\n    implementation 'com.github.Navideck:Universal-Volume:v1.1.2'\n    ...\n}\n```\n\n## Usage\n\n### Initialization\n\nInitialize the Universal Volume library once in your application:\n\n```kotlin\nval universalVolume = UniversalVolume.instance\n\nuniversalVolume.initialize(context)\n```\n\n### Get/Set Volume\n\nYou can retrieve and adjust volume levels using the following methods:\n\n```kotlin\n// Get current volume\nval currentVolume = universalVolume.volume\n\n// Get maximum volume\nval maxVolume = universalVolume.maxVolume\n\n// Get minimum volume\nval minVolume = universalVolume.minVolume\n\n// Set volume to a specific value\nuniversalVolume.setVolume(volume: Int)\n```\n\n### Handling Different Volume Ranges\n\nSome devices may have varying volume ranges, such as 0 to 15 or 0 to 30. To handle this, you can use the \"volume percentage\" methods:\n\n```kotlin\n// Get volume between 0 to 1 as a float value\nval currentVolumePercentage = universalVolume.volumeInPercentage\n\n// Set volume between 0 to 1 as a float value\nuniversalVolume.setVolumeToPercentage(percentage: Double, showVolumeBar: Boolean)\n```\n\n### Volume Change Listener\n\nYou can set up a volume change listener to be notified when the volume changes:\n\n```kotlin\n// Create a volume change listener\nval volumeChangeListener = object : VolumeChangeListener {\n    override fun onChange(volume: Int) {\n        // Handle volume changes here\n    }\n}\n\n// Add the listener\nuniversalVolume.addVolumeChangeListener(volumeChangeListener)\n\n// Remove the listener when it's no longer needed\nuniversalVolume.removeVolumeChangeListener(volumeChangeListener)\n```\n\n### Cleanup\n\nWhen you are done using the Universal Volume instance, remember to dispose of it properly:\n\n```kotlin\nuniversalVolume.dispose()\n```\n\n## Note\n\nPlease note that the library currently handles volume controls specifically for `AudioManager.STREAM_MUSIC`.\n\n## Documentation\n\nFor detailed usage instructions and additional information, please refer to the [full documentation](https://navideck.github.io/Universal-Volume/).\n\n## Contribution\n\nContributions to Universal Volume are welcome! We would like to support more exotic Android devices that use proprietary volume APIs. We encourage pull requests that add support for such devices.\nIf you encounter any issues or have suggestions for improvements, please submit an issue or pull request on the [GitHub repository](https://github.com/Navideck/Universal-Volume).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnavideck%2Funiversal-volume","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnavideck%2Funiversal-volume","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnavideck%2Funiversal-volume/lists"}