No Activity found to handle Intent when using FileProvider
<p>In my app I have a custom auto download and install APK it works like this</p>

<pre><code>  // auto register for the complete download
     activity.registerReceiver(onComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));



 // Download the file through DownloadManager
 String destination = Environment.getExternalStorageDirectory() + "/";
    String fileName = "myfile.apk";
    destination += fileName;
    final Uri uri = Uri.parse("file://" + destination);
    DownloadManager.Request request = new  DownloadManager.Request(Uri.parse(apkUrl));
    request.setDescription("description");
    request.setTitle("title");
    request.setDestinationUri(uri);
    final DownloadManager manager = (DownloadManager) activity.getSystemService(Context.DOWNLOAD_SERVICE);
    final long downloadId = manager.enqueue(request);

onComplete = new BroadcastReceiver() {
      public void onReceive(Context ctxt, Intent intent) {

          Intent install = new Intent(Intent.ACTION_VIEW);
          // BEFORE working doing this
          //install.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
          //install.setDataAndType(uri,
          //    manager.getMimeTypeForDownloadedFile(downloadId));

          // Using file provider it doesnt work
          Uri apkUri = FileProvider.getUriForFile(AutoUpdate.this,
              "com.myapp", file);
                install.setDataAndType(apkUri,manager.getMimeTypeForDownloadedFile(downloadId));
          activity.startActivity(install);
          activity.unregisterReceiver(this);

      }
    };
</code></pre>

<p>Android manifest:</p>

<pre><code>&lt;provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="com.myapp"
            android:exported="false"
            android:grantUriPermissions="true"&gt;
            &lt;meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths"/&gt;
        &lt;/provider&gt;
</code></pre>

<p>Provider_path (Sorry for some reason so cuts the path tag)</p>

<blockquote>
  <p>external-path name="myfolder" path="."/></p>
</blockquote>

<p>When the file finished to download the onComplete is called but the activiy doesn't start:</p>

<blockquote>
  <p>No Activity found to handle Intent { act=android.intent.action.VIEW
  dat=content://com.myapp/myfolder/myfile.apk
  typ=application/vnd.android.package-archive flg=0x4000000 }</p>
</blockquote>

<p>When using the normal file:// it does work</p>

<p>Is there something I'm missing when using the file provider? Does the activity doesn't start because the file is not found ?
Do I need extra permission ? (at the moment I have INTERNET, READ and WRITE on external storage)</p>