qt for android 控制系统的不同音量
示例
QAndroidJniObject activity = QtAndroid::androidActivity();
QAndroidJniObject name = QAndroidJniObject::getStaticObjectField("android/content/Context","AUDIO_SERVICE","Ljava/lang/String;");
QAndroidJniObject service = activity.callObjectMethod("getSystemService","(Ljava/lang/String;)Ljava/lang/Object;",name.object<jstring>());
service.callMethod<void>("setStreamVolume", "(III)V", 5, 0, 4);
service.callMethod<void>("setStreamVolume", "(III)V", 3,15,4);
代码详解
AudioManager 参数详解
getSystemService 获取系统服务
service.callMethod(“setStreamVolume”, “(III)V”, 5, 0, 4); 设置通知音量
service.callMethod(“setStreamVolume”, “(III)V”, 3,15,4); 设置音乐视频等音量
上述链接有对 setStreamVolume 已经后面的参数如5,0,4的解释