AlarmSoundService: don't set volume to 100% if music is playing.

Have mercy with my ears.
This commit is contained in:
Johannes Mockenhaupt 2018-01-27 20:08:39 +01:00
parent db5ee7067a
commit 3be65319d7
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -1,8 +1,10 @@
package info.nightscout.androidaps.Services;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetFileDescriptor;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.IBinder;
@ -53,7 +55,10 @@ public class AlarmSoundService extends Service {
log.error("Unhandled exception", e);
}
player.setLooping(true); // Set looping
AudioManager manager = (AudioManager)this.getSystemService(Context.AUDIO_SERVICE);
if (manager == null || !manager.isMusicActive()) {
player.setVolume(100, 100);
}
try {
player.prepare();