Android Question play a media in ringtone volume

catyinwong

Active Member
Licensed User
Longtime User
since there is two volume setting in phone, one for media and one for ringtones. is it possible to set the media player to play in the volume level for ringtone?
 

catyinwong

Active Member
Licensed User
Longtime User

Here is the code I tried:

B4X:
dim mp as mediaplayer 
mp.initialize2("mp")
mp.load(file.dirinternal,"testing.mp3")
dim jo as javaobject =mp
dim p as phone
jo.getfieldjo("mp").runmethod("setAudioStreamType"), array(p.volume_notification))
mp.looping =true
mp.play

And then the play will be silent ( no sound). But I have already set the ringtone volume to the loudest for testing. May I ask why?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…