UltimateMusicPicker
An Android music picker library for picking alarm, notification or ringtones sound using an Activity or a dialog.
Screenshot
![]() |
![]() |
![]() |
Gradle Dependency
Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
Step 2. Add the dependency
Usage
Things to remember:
-
No permission is needed(
RingtoneManager
is used internally) unless you use.music()
to select music files in the external storage.If so, add
READ_EXTERNAL_STORAGE
permission to your app'sManifest.xml
and the library will handle permission request properlly. -
When use
.goWithDialog(supportFragmentManager)
, the calling class should implementMusicPickerListener
to get pick result. -
When use
.goWithActivity(this, 0, MusicPickerActivity::class.java)
(the thrid parameter is an Activity implementingMusicPickerListener
), addMusicPickerActivity
(already defined in the library) in yourManifest.xml
.Then in the activity's
onActivityResult
,
Advanced Usage
The picker view is a Fragment
so it can be easily used in an Activity and a dialog.
Custom Activity
Simply copy and paste MusicPickerActivity
or MusicPickerDialog
and create your own. You may notice it's just a wrapper for MusicPickerFragment
and it can be used in many places(like in a ViewPager
?)
What's more, there are two methods in the UltimateMusicPicker
class to help you.
Dark Theme
This library supports dark theme with a naive way. It works fine when I use AppCompatDelegate.setDefaultNightMode
to toggle night theme. If this is not enough, open a issue or send a PR.
Todo List
AndoridX support- Use
READ_CONTENT
to select without permission