Skip to content

Make Custom sound through absolute file paths#43

Merged
Fector101 merged 2 commits into
without-androidxfrom
without-androidx-custom-sound
May 24, 2026
Merged

Make Custom sound through absolute file paths#43
Fector101 merged 2 commits into
without-androidxfrom
without-androidx-custom-sound

Conversation

@Fector101
Copy link
Copy Markdown
Owner

@Fector101 Fector101 commented May 23, 2026

Passed Test on pydroid 3
Install through https://github.com/Fector101/android_notify/archive/without-androidx-custom-sound.zip

sound_path accepts:

  • Absolute path: e.g- /storage/emulated/0/Download/custom_sound.mp3
  • Relative path: e.g- assets/sound.wav Resolve to an absolute path in the Python environment
  • Android content URIs: e.g, -content://com.android.providers.media.documents/document/audio%3A12345, If the path starts with content:// or file:// or android.resource:// this allows seamless integration with file/audio pickers.

If the user provides a path to a file on public storage (like /storage/emulated/0/...) the app will require storage permissions:
READ_EXTERNAL_STORAGE on Android 12 and below.
READ_MEDIA_AUDIO on Android 13+.

from kivy.app import App
from kivy.uix.button import Button
from android_notify import Notification

wav_file_path="/storage/emulated/0/sneeze.wav"

class AndroidNotifyDemoApp(App):
    def build(self):
        return Button(
            text="Send Notification",
            on_release=self.send_notification
        )

    def send_notification(self, *args):
        Notification.createChannel(
            id="game",
            name="Game Sound Tester",
            description="A custom sounds from the phone folder.",
            sound_path=wav_file_path
        )
        n=Notification(
            title="Hello from Android Notify",
            message="This is a basic notification.",
            channel_id="game",
        )
        n.setSound(sound_path=wav_file_path)
        n.send()


if __name__ == "__main__":
    AndroidNotifyDemoApp().run()

@Fector101 Fector101 merged commit 1ae9f13 into without-androidx May 24, 2026
1 check passed
@Fector101 Fector101 deleted the without-androidx-custom-sound branch May 24, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant