title: Android app unable to modify system settings
body: <p>I'm looking for some assistance in modifying Android system settings via an app.</p>
  
  <p>I'm having some trouble getting a custom Android app to run properly under Kitkat 4.4.2. I'm not sure what the source of my frustrations is, but I'm thinking I'm missing some kind of security setting or trick in the Manifest.</p>
  
  <p>Background: I am not a developer, but this project has fallen into my lap. Before deploying our tablets, we install our MDM and company apk to the tablet, and also run a simple program to configure some of the system settings. We perform a root on the tablet and install the SU binaries along this process.</p>
  
  <p>I've added ACCESS_SUPERUSER to my manifest, but I am not being prompted by SuperSU requesting SU access for this app. Additionally, if I try to run the app, I recieve a "App isn't installed" toast message. (I replaced the application name with APPLICATION below)</p>
  
  <p>Java Code</p>
  
  <pre><code>Settings.Global.putInt(MainActivity.this.getContentResolver(), Settings.Global.INSTALL_NON_MARKET_APPS, 1);
  Settings.Global.putInt(MainActivity.this.getContentResolver(), Settings.Global.STAY_ON_WHILE_PLUGGED_IN, 1);
  Settings.Secure.putInt(MainActivity.this.getContentResolver(), Settings.Secure.LOCK_PATERN_ENABLED, 0);
  Settings.Secure.putInt(MainActivity.this.getContentResolver(), Settings.Secure.LOCK_PATTERN_VISIBLE, 0);
  Settings.System.putInt(MainActivity.this.getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, 300000);
  Settings.Secure.putInt(MainActivity.this.getContentResolver(), Settings.Global.ADB_ENABLED, 0);
  </code></pre>
  
  <p>Manifest</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.APPLICATION"
      android:versionCode="1"
      android:versionName="1.2" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="19"
          android:targetSdkVersion="19" /&gt;
  
      &lt;uses-permission android:name="android.permission.ACCESS_SUPERUSER"/&gt;
      &lt;uses-permission android:name="android.permission.WRITE_SETTINGS"/&gt;
      &lt;uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme"
          android:persistent="false"
          android:permission="android.permission.WRITE_SECURE_SETTINGS"
          android:exported="true" &gt;
          &lt;activity
              android:name="com.example.APPLICATION.MainActivity"
              android:label="@string/app_name"
              android:exported="true" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>Logcat Errors</p>
  
  <blockquote>
    <p>11-20 17:17:51.749: E/Launcher(686): Launcher does not have the
    permission to launch Intent { act=android.intent.action.MAIN
    cat=[android.intent.category.LAUNCHER] flg=0x10200000
    cmp=com.example.APPLICATION/.MainActivity }. Make sure to create a MAIN
    intent-filter for the corresponding activity or use the exported
    attribute for this activity. tag=ApplicationInfo(title=SetSet id=-1
    type=0 container=-1 screen=-1 cellX=-1 cellY=-1 spanX=1 spanY=1
    dropPos=null) intent=Intent { act=android.intent.action.MAIN
    cat=[android.intent.category.LAUNCHER] flg=0x10200000
    cmp=com.example.setset/.MainActivity }</p>
    
    <p>11-20 17:32:16.169: E/AndroidRuntime(4744):
    java.lang.RuntimeException: Unable to start activity
    ComponentInfo{com.example.setset/com.example.APPLICATION.MainActivity}:
    java.lang.SecurityException: Permission denial: writing to secure
    settings requires android.permission.WRITE_SECURE_SETTINGS</p>
  </blockquote>