Android Question How can i play default alarm sound ?

laviniut

Active Member
Licensed User
Longtime User
I need some help. I made a Battery monitoring app with notification and i need to play default alarm sound even in do not disturb mode (alarm only or vibrate), i suppose in STREAM_ALARM mode. Can somebody help me?
 

laviniut

Active Member
Licensed User
Longtime User
I used successfully this code:
B4X:
            Dim mp As MediaPlayer
            mp.Initialize
            Dim r As Reflector
            r.Target = mp
            r.Target = r.GetField("mp")
            r.RunMethod2("setAudioStreamType","4","java.lang.int")
            mp.Load(File.DirAssets, "alarmsound.mp3")
            mp.Play

but i want to play default alarm sound, not alarmsound.mp3.
How can i play default alarm sound?
 
Upvote 0
Top