title: How to read an existing file from device's shared storage(root directory) in Android 10, Target API 29?
body: <p>I need to read a file stored in android root directory(/storage/emulated/0/MyFolder) while launching the app first time.</p>
  
  <p>It was possible till API level 28 by using <code>Environment.getExternalStorageDirectory()</code>, But after I migrated to API level 29, <code>Environment.getExternalStorageDirectory()</code> deprecated and stopped working with below message.</p>
  
  <blockquote>
    <p>This method was deprecated in API level 29. To improve user privacy,
    direct access to shared/external storage devices is deprecated. When
    an app targets Build.VERSION_CODES.Q, the path returned from this
    method is no longer directly accessible to apps. Apps can continue to
    access content stored on shared/external storage by migrating to
    alternatives such as Context#getExternalFilesDir(String), MediaStore,
    or Intent#ACTION_OPEN_DOCUMENT.</p>
  </blockquote>
  
  <p>Also I tried <code>Context().getExternalFilesDir(null)</code> which was returning the following path only "/storage/emulated/0/Android/data/com.myapp.appid/files/", but I need to access a file in "/storage/emulated/0/" path.</p>
  
  <p>So how to read the file in location "/storage/emulated/0/MyFolder" in legal way when running with target API level 29?</p>