سؤال

I have an android app that changes the users ringer preference or notification volume when music is playing.

Is there a way that I can store their current volume settings across all streams and restore it when my service is killed?

هل كانت مفيدة؟

المحلول

I used getStreamVolume(); to get the volume and I then stored the value until the service was killed. After the service was killed I used setStreamVolume(); to return the volume to the stored setting.

Android Reference - getStreamVolume();

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top