Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I was able to achieve this through looking at the settings and configuring the setting programatically:</p> <pre><code>android.provider.Settings.System.putInt(getContentResolver(), "dock_sounds_enabled", 1); </code></pre> <p>You need the permission:</p> <pre><code>&lt;uses-permission android:name="android.permission.WRITE_SETTINGS"/&gt; </code></pre> <p>The code above will write to the settings that enables the dock sound settings on the samsung s3. <strong>However;</strong> instead of just writing it you should tell the user that the setting is disabled and you need it enabled and allow the user to confirm they want to enable it via a dialog. </p> <p>On another note, I don't think its possible to go directly to the settings->accessory screen because its was a custom settings added by Samsung. This action is <strong>not</strong> provided in the Android SDK, so it would take a while to derive what is the actual action or even if it exists.</p> <p>And if you want to confirm it just query it:</p> <pre><code>String where = "name = 'dock_sounds_enabled'"; Cursor c = getContentResolver().query(android.provider.Settings.System.CONTENT_URI, null, where, null, null); </code></pre> <h2>Update</h2> <p>Steps for how to handle the dialog's response for configuring the dock setting:</p> <ul> <li><p>Grab the setting.. if it's 0, bring up the dialog to enable it, otherwise continue with your processing</p></li> <li><p>Once the dialog is up and the user confirms they want to enable it: </p></li> <li><p>Confirm: Put a 1 into the dock sounds then close the dialog </p></li> <li>Deny: Don't set the dock setting then close dialog</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload