放到载入事件中
//使用外置扬声器
s cl1="android.content.Context"
s cl2="android.media.AudioManager"
javax(ct,activity,cl1,"getApplicationContext")
javags(str,ct,cl1,"AUDIO_SERVICE")
javax(aM,ct,cl1,"getSystemService","String",str)
javax(null,aM,cl2,"setMicrophoneMute","boolean",false)
javax(null,aM,cl2,"setSpeakerphoneOn","boolean",true)
javags(mode,aM,cl2,"STREAM_MUSIC")
javax(null,aM,cl2,"setMode","int",mode)
//获取最大媒体音量值
javax(max,aM,cl2,"getStreamMaxVolume","int",mode)
//设置媒体音量为最大值
javax(null,aM,cl2,"setStreamVolume","int",mode,"int",max,"int",0)文章源自灵鲨社区-https://www.0s52.com/bcjc/iappjc/284.html
文章源自灵鲨社区-https://www.0s52.com/bcjc/iappjc/284.html
文章源自灵鲨社区-https://www.0s52.com/bcjc/iappjc/284.html
另外需要在AndroidManifest.xml中添加一条权限。文章源自灵鲨社区-https://www.0s52.com/bcjc/iappjc/284.html
文章源自灵鲨社区-https://www.0s52.com/bcjc/iappjc/284.html 文章源自灵鲨社区-https://www.0s52.com/bcjc/iappjc/284.html
评论