android-audiomanager

Enable Silent Mode in android without triggering Do Not Disturb

早过忘川 提交于 2020-06-24 11:21:27
问题 Having a little trouble bending my head around this one. In my volume control app I am trying to set the system sound profile to SILENT ONLY without triggering do not disturb, my app has access to modify DND settings and notification access, no issues there. System Settings has a silent profile that leaves DND off but I cannot find a way to do it using audio manager? I have attempted to set the mode to silent and then change DND settings using NotificationManager, disabling DND after setting

Enable Silent Mode in android without triggering Do Not Disturb

这一生的挚爱 提交于 2020-06-24 11:21:26
问题 Having a little trouble bending my head around this one. In my volume control app I am trying to set the system sound profile to SILENT ONLY without triggering do not disturb, my app has access to modify DND settings and notification access, no issues there. System Settings has a silent profile that leaves DND off but I cannot find a way to do it using audio manager? I have attempted to set the mode to silent and then change DND settings using NotificationManager, disabling DND after setting

How to switch audio output from Phone, Phone Speaker, earphones or Bluetooth device

徘徊边缘 提交于 2020-02-03 23:38:52
问题 Im trying to switch the audio source between different source in my app. We use a 3rd party Video Library and use AudioManager to play the sound. Now we are trying to have a UI option to select between audio output between Phone ear piece, Phone Speaker, Headphones/ Bluetooth (is any connected). Like we see in Phone Call app (when multiple audio output sources are available phone, speaker, bluetooth). 回答1: Got it working: 'if(false) { //For BT mAudioManager.setMode(AudioManager.MODE_IN

How to switch audio output from Phone, Phone Speaker, earphones or Bluetooth device

女生的网名这么多〃 提交于 2020-02-03 23:38:22
问题 Im trying to switch the audio source between different source in my app. We use a 3rd party Video Library and use AudioManager to play the sound. Now we are trying to have a UI option to select between audio output between Phone ear piece, Phone Speaker, Headphones/ Bluetooth (is any connected). Like we see in Phone Call app (when multiple audio output sources are available phone, speaker, bluetooth). 回答1: Got it working: 'if(false) { //For BT mAudioManager.setMode(AudioManager.MODE_IN

Missing permission to control media error on Android 5/L

ε祈祈猫儿з 提交于 2020-01-15 07:00:27
问题 Missing permission to control media error on Android 5/L Got the below error on this line while trying to setup a RemoteController. I couldn't find any info on this error so wanted to post the error and the simple solution. Code that triggered it: if(!((AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE)).registerRemoteController(mRemoteController)) {...} Error: E/AndroidRuntime(21073): FATAL EXCEPTION: main E/AndroidRuntime(21073): Process: com.example.widgetdemo, PID: 21073 E

Missing permission to control media error on Android 5/L

元气小坏坏 提交于 2020-01-15 07:00:21
问题 Missing permission to control media error on Android 5/L Got the below error on this line while trying to setup a RemoteController. I couldn't find any info on this error so wanted to post the error and the simple solution. Code that triggered it: if(!((AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE)).registerRemoteController(mRemoteController)) {...} Error: E/AndroidRuntime(21073): FATAL EXCEPTION: main E/AndroidRuntime(21073): Process: com.example.widgetdemo, PID: 21073 E

play sound file with a delay and adjust time in android

久未见 提交于 2020-01-06 11:25:59
问题 I am trying to program a sound app where on button click I would like to play 3-4 sound files one after the other. How can this be done? Also I would like to increase the time of play of the files. Is this where the loop variable in play function used?? Here is part of code I have done with SoundPool. However the files all play simultaneously :( public void onClick(View v){ //check for scan button if(v.getId()==R.id.playbutton){ queueSound(1000); sound.changePitchfile3(R.raw.a0); queueSound

How to Sync Sounds using SoundPool

爱⌒轻易说出口 提交于 2020-01-01 09:58:44
问题 I have been trying to get a few sounds to play at the same time; currently i'm using a shared instance of SoundPool. I would like 1, 2 or 3 sounds to be played at the exact same time with no lag. When calling SoundPool.play(...) X number of times in succession, the sounds are played in that order as one might think. what is the proper what to achieve this where i can prepare all of the sounds to be played at the same time and then play them as one? Sudo Code: SoundPool _soundPool = new

How to Sync Sounds using SoundPool

爱⌒轻易说出口 提交于 2020-01-01 09:58:35
问题 I have been trying to get a few sounds to play at the same time; currently i'm using a shared instance of SoundPool. I would like 1, 2 or 3 sounds to be played at the exact same time with no lag. When calling SoundPool.play(...) X number of times in succession, the sounds are played in that order as one might think. what is the proper what to achieve this where i can prepare all of the sounds to be played at the same time and then play them as one? Sudo Code: SoundPool _soundPool = new

Changing ringer profile when receiving sms

不羁岁月 提交于 2020-01-01 07:03:44
问题 Hello there i'm newbie in Android development I'm trying to make an app that changes the ringer profile when receive a specific sms, also i can change it by the buttons on the layout (the buttons are working good), but the sms way isn't working i tried as shown below MainActivity.java package com.example.test; import android.media.AudioManager; import android.os.Bundle; import android.app.Activity; import android.content.Context; import android.view.Menu; import android.view.View; import