rolinger opened a new issue, #599:
URL: https://github.com/apache/cordova-plugin-file/issues/599

   # Bug Report
   1.  My app has been using `cordova.file.externalRootDirectory + 
"Download/MyAppDir"` to write files since Android 9 or 10 and it has all 
worked, but now suddenly on Android 13 it has stopped when a device was 
migrated from Device A to Device B.  Device A was a busted phone, and all the 
content/apps/folders, etc was migrated to the new Device B.
   
   ```
   cordova.file.externalRootDirectory =  file:///storage/emulated/0/
         Images/
         Documents/
         Download/
               MyAppDir/ (if not exist, create)
                     aFiles/    (if not exist, create)
                          a-hello.doc  (file downloaded from app)
                          a-goodbye.pdf (file downloaded from app)
                          a-presentation.ppt (file downloaded from app)
                          ...
                     bFiles/    (if not exist, create)
                          b-hello.doc  (file downloaded from app)
                          b-goodbye.pdf (file downloaded from app)
                          b-presentation.ppt (file downloaded from app)
                          ...
                     cFiles/
                     .....
   ```
   
   Via the UIs `File Manager` app, you can browse to the `Downloads` folder and 
then into the `MyAppDir` folder and can access sub-folders and all the 
downloaded files.  This is the case before and after the migration - all is 
good so far.
   
   But after the migration to Device B, my app can no longer download to the 
`MyAppDir` folder or any of its subfolders.  My app was receiving a `permission 
denied` error
   
   So I start troubleshooting thinking maybe Android 13 now requires 
permissions to access this area.  And after multiple fruitless tests, I deleted 
one of the sub-folders (`aFiles`)...then in my app tried to download a file 
that would need the `aFiles` folder.  The app successfully created a new 
`aFiles` folder AND successfully downloaded the file again.
   
   I ran this test multiple times across the other various sub-folders and was 
able to replicate it problem every time.  `permission denied` - then I deleted 
to the folder, tried the download again, it recreated the folder and 
successfully downloaded the file.  My app created all these folders, why 
couldn't my app access them again until after I deleted them and redownloaded?  
Even more odd though...is I only had to delete the `MyAppDir` subfolders to get 
this to work.  I didn't have to delete the main `MyAppDir` folder at all.
   
   I can't have users deleting folders and redownloading content again.  I 
think during the upgrade or migrating the phone the device somehow lost the 
reference that those folders were created by my app and thus wouldn't allow me 
to download to them again.  When manually deleting them and then recreating 
them, its like the association was restored  and new permissions were granted.  
   
   **How can I account for such issues?**
   
   On a side note:
   
    What directory does `cordova.file.externalDataDirectory` actually write to? 
 I can download files and write to it with no problem, there no permissions 
issues.  But then on the users phone, via FileManager, you can't find the file 
anywhere...where is it being written to and how can the users "File" app locate 
the downloaded file?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to