Reading and writing SD cards requires runtime permission processing, but using the associated directory can skip this step
If it is lower than Android 7.0, call Uri's fromFile() to convert the File object into a Uri object. Otherwise, call the getUriForFile() method of FileProvider to convert the File object into an encapsulated Uri object.
getUriForFile() accepts three parameters 1.Context 2. Can be any unique string 3. The File object just created. Since 7.0 it is considered unsafe to use the local real Uri directly. A FileExposedException will be thrown. The FileProvider is a special content provider that protects data and can selectively share the encapsulated Uri to the outside, thereby improving security.