Forum Xamarin.iOS

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

How can I max out the volume on iOS on Notification Received?

Cdn_EuroCdn_Euro Member ✭✭✭
edited August 2018 in Xamarin.iOS

I am making an app that alerts the user about an urgent notification and I need to increase the volume when the notification is received, in case the device volume is low or mute.

I did do this in android, is it possible on iOS and if yes how please?

For Android, this is how I managed to do it:

private void setNotificationVolumeToMax()
        {
            try
            {
                var audioManager = (AudioManager)GetSystemService(Context.AudioService);

                int max_volume = audioManager.GetStreamMaxVolume(Android.Media.Stream.Notification);
                audioManager.SetStreamVolume(Android.Media.Stream.Notification, max_volume, 0);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }

Answers

Sign In or Register to comment.