title: getting exposed beyond app through Intent.getData() error while installing the downloaded apk file
body: <p>I have downloaded the apk file from server and now installing it but it gives me an error: getting exposed beyond app through Intent.getData()</p>
  
  <p>My code is</p>
  
  <pre><code>Intent intent = new Intent(Intent.ACTION_VIEW);
          intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
  
  
          intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() +
                  "/download/" + "in.sample.myapp.apk")), "application/vnd.android.package-archive");
  </code></pre>
  
  <p>I have searched for the error and found some but unable to solve the problem. The suggestion was to use FileProvider. I did that like below just to check the log</p>
  
  <pre><code>Log.d("NewPath", "NewPathName is: " +(FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider",outputFile)));
  </code></pre>
  
  <p>could help this out.</p>
  
  <p>Please help and suggest.</p>