AlarmSoundService: don't set volume to 100% if music is playing.
Have mercy with my ears.
This commit is contained in:
parent
db5ee7067a
commit
3be65319d7
1 changed files with 6 additions and 1 deletions
|
@ -1,8 +1,10 @@
|
||||||
package info.nightscout.androidaps.Services;
|
package info.nightscout.androidaps.Services;
|
||||||
|
|
||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.AssetFileDescriptor;
|
import android.content.res.AssetFileDescriptor;
|
||||||
|
import android.media.AudioManager;
|
||||||
import android.media.MediaPlayer;
|
import android.media.MediaPlayer;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
|
||||||
|
@ -53,7 +55,10 @@ public class AlarmSoundService extends Service {
|
||||||
log.error("Unhandled exception", e);
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
player.setLooping(true); // Set looping
|
player.setLooping(true); // Set looping
|
||||||
|
AudioManager manager = (AudioManager)this.getSystemService(Context.AUDIO_SERVICE);
|
||||||
|
if (manager == null || !manager.isMusicActive()) {
|
||||||
player.setVolume(100, 100);
|
player.setVolume(100, 100);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
player.prepare();
|
player.prepare();
|
||||||
|
|
Loading…
Reference in a new issue