Android Question Problem playing custom sound in Notification Builder Library

Discussion in 'Android Questions' started by dieterp, Feb 5, 2015.

  1. dieterp

    dieterp Active Member Licensed User

    I am using the Notification Builder Library developed by @barx to handle the incoming notifications to my device. I am however having a problem with the CustomSound functionality. When I directly copy a 'notification.ogg' file to the 'Notifications' folder on my device, it works fine when I use the code Notification2.CustomSound = "file:///sdcard/notifications/notification.ogg"

    However, when I copy the 'notification.ogg' file to the File.DirDefaultExternal folder, I cannot seem to play it from that folder. I've tried several paths (using file:///) but I just can't seem to get it to play. Will it not work from the File.DirDefaultExternal folder? I've posted the question in the Notification Builder forum, but @barx also doesn't seem to know if it would work or not. Anyone have any ideas for me?

    Regards
     
  2. Dieter Baumgartner

    Dieter Baumgartner Member Licensed User

    I can't get it to work either with the File.DirDefaultExternal folder. Any news how to play the customSound from this folder ?
     
  3. dieterp

    dieterp Active Member Licensed User

    It sounds like this is a problem that only affects guys called Dieter! I just ended up using the SoundPool library, so I play the notification file when the notification comes through

    Code:
    Dim SP As SoundPool
    Dim snd_file As Int

    SP.Initialize(
    1)
       snd_file = SP.Load(
    File.DirAssets,"my_sound.ogg")
     
    Dieter Baumgartner likes this.
  4. Dieter Baumgartner

    Dieter Baumgartner Member Licensed User

    Thank you very much, this works. Sometimes the easiest way is the best, but i was so fixed to get the Notification Builder custom sound running, that i didn't see the easy way !!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice