title: Android Wifi DPP (Wi-Fi Easy Connect)
body: <p>Since Android 10+ doesn't let you connect to wifi networks programmatically anymore (you can only suggest/add networks to the list but they may never connect if you have an existing wifi connect), I'd like to use WiFi Easy Connect
  <a href="https://source.android.com/devices/tech/connect/wifi-easy-connect" rel="nofollow noreferrer">(https://source.android.com/devices/tech/connect/wifi-easy-connect)</a>
  I'm assuming this is basically what the qr code scanning option is, that's accessed from wifi settings.</p>
  <p>The documentation states that you should check whether it's supported:</p>
  <pre><code>Public APIs are available in Android 10 for use by apps:
  
      WifiManager#isEasyConnectSupported: Queries the framework to determine whether the device supports Wi-Fi Easy Connect.
      Activity#startActivityForResult(ACTION_PROCESS_WIFI_EASY_CONNECT_URI): Allows apps to integrate Wi-Fi Easy Connect into their onboarding/setup flow.
  </code></pre>
  <p>Which I've done as:</p>
  <pre><code>if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.Q)
      {
          val wifiManager = getSystemService(Context.WIFI_SERVICE) as WifiManager
          if (wifiManager.isEasyConnectSupported)
          {
              startActivityForResult(Intent(android.provider.Settings.ACTION_PROCESS_WIFI_EASY_CONNECT_URI), 1237)
          }
      }
  </code></pre>
  <p>However, this crashes as the activity is not found (I have tested on a Pixel 4XL and emulator both running R):</p>
  <pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
      Process: xxx, PID: 8498
      android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.PROCESS_WIFI_EASY_CONNECT_URI }
  </code></pre>
  <p>Is this possible to be used by apps?
  Is there another way to actually connect to a wifi network reliably?
  Is this the correct approach? or is there a way to launch the setting screen directly?</p>
  <p>I found these in an android manifest but I can't find a way to launch them:</p>
  <pre><code> &lt;activity
      android:name=&quot;.wifi.dpp.WifiDppConfiguratorActivity&quot;&gt;
      &lt;intent-filter&gt;
          &lt;action android:name=&quot;android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER&quot;/&gt;
          &lt;action android:name=&quot;android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR&quot;/&gt;
          &lt;category android:name=&quot;android.intent.category.DEFAULT&quot;/&gt;
      &lt;/intent-filter&gt;
      &lt;intent-filter&gt;
          &lt;action android:name=&quot;android.settings.PROCESS_WIFI_EASY_CONNECT_URI&quot;/&gt;
          &lt;category android:name=&quot;android.intent.category.DEFAULT&quot;/&gt;
          &lt;data android:scheme=&quot;DPP&quot;/&gt;
      &lt;/intent-filter&gt;
  &lt;/activity&gt;
  
  &lt;activity
      android:name=&quot;.wifi.dpp.WifiDppEnrolleeActivity&quot;&gt;
      &lt;intent-filter&gt;
          &lt;action android:name=&quot;android.settings.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER&quot;/&gt;
          &lt;category android:name=&quot;android.intent.category.DEFAULT&quot;/&gt;
      &lt;/intent-filter&gt;
  &lt;/activity&gt;
  </code></pre>