RingtoneSmartKit is designed for Android developers seeking a simple solution for managing ringtones, notifications, and alarms. This lightweight Kotlin library allows for effortless customization of ringtones for all contacts or specific ones, eliminating boilerplate code and enabling efficient programmatic control.
RingtoneSmartKit offers a seamless solution for Android developers looking to set and customize ringtones, notification sounds, and alarms with minimal effort. This lightweight Kotlin library allows users to manage ringtones programmatically, either globally or for specific contacts, without the need for cumbersome boilerplate code.
RingtoneHelper.setSystemRingtone(
source = RingtoneSource.FromAssets("ringtones/my_ringtone.mp3"),
target = SystemTarget.Call // or Notification, Alarm
).onSuccess {
println("✅ System ringtone set successfully")
}.onFailure { error ->
println("❌ Error setting system ringtone: ${error.message}")
}.onDone {
println("Operation completed")
}.launch()
RingtoneHelper.setContactRingtone(
source = RingtoneSource.FromStorage(Uri.parse("content://media/internal/audio/media/10")),
target = ContactTarget.ByPhone("+1234567890")
).onSuccess { contact ->
println("✅ Ringtone set for contact: ${contact.displayName}")
}.onFailure { error ->
println("❌ Error setting contact ringtone: ${error.message}")
}.onDone {
println("Operation completed")
}.launch()
Ringtones can be loaded from:
// From the app's assets directory:
RingtoneSource.FromAssets(filePath = "ringtones/my_ringtone.mp3")
// From device storage:
RingtoneSource.FromStorage(uri = "content://media/internal/audio/media/10".toUri())
| Callback | Triggered When... |
|---|---|
onSuccess | A ringtone is set successfully. No arguments for system ringtones; provides ContactInfo for contact ringtones. |
onFailure | An error occurs; receives a Throwable for debugging purposes. |
onDone | Signals the conclusion of an operation, whether successful or failed. |
RingtoneSmartKit is available for easy integration via:
For more information, source code, and documentation, visit the GitHub Repository.
RingtoneSmartKit provides a straightforward, efficient way to enhance Android applications by managing ringtones with minimal complexity.
No comments yet.
Sign in to be the first to comment.