How to access iphone system settings

How can I access (read) the "global settings" in the iPhone application.

Idea: my application provides "keystrokes" - I want to enable / disable them using what users set in the iPhone settings.

But I have no idea how to read these settings (the status of "mute switch" is also interesting).

+3
source share
1 answer

For silent switch, see here. http://www.restoroot.com/Blog/2008/12/25/audiosessioninitialize-workarounds/

Essentially, you just need this.

// "Ambient" makes it respect the mute switch
    // Must call this once to init session
    if (!gAudioSessionInited)
    {
        AudioSessionInterruptionListener    inInterruptionListener = NULL;
        OSStatus    error;
        if ((error = AudioSessionInitialize (NULL, NULL, inInterruptionListener, NULL)))
        {
            NSLog(@"*** Error *** GBMusicTrack - initWithPath: error in AudioSessionInitialize: %d.", error);
        }
        else
        {
            gAudioSessionInited = YES;
        }
    }

    SInt32  ambient = kAudioSessionCategory_AmbientSound;
    if (AudioSessionSetProperty (kAudioSessionProperty_AudioCategory, sizeof (ambient), &ambient))
    {
        NSLog(@"*** Error *** GBMusicTrack - initWithPath: could not set Session property to ambient.");
    }

As for reading system settings, you cannot, at least not through the public APIs!

0
source

Source: https://habr.com/ru/post/1724104/


All Articles