0

The problem I need to solve is to listen for a file deletion event in the device's file manager and create a backup file to store it in a specific directory. illustrative image

I have tried using FileObserver(), but it seems to not work as expected. FileObserver only returns the path after the file has been deleted, which means I cannot create a backup file.

Is there any way to solve this issue using a BroadcastReceiver? I have attempted to find a suitable Intent Action but have been unsuccessful so far.

Is there any way to solve this issue or not?

  • "Is there any way to solve this issue or not?" -- you would have to create your own version of the OS. "Is there any way to solve this issue using a BroadcastReceiver?" -- there is no requirement for any application (file manager or otherwise) to broadcast its intention to delete something. – CommonsWare Jun 23 '23 at 10:51
  • @CommonsWare Thank you for your answer, So there is no event to delete files from the system that is listened by broadcast? If so, do you have any other way to help me solve my problem or not, if yes please help and let me know. Thanks! – Duy Lê Thế Jun 25 '23 at 04:54
  • "So there is no event to delete files from the system that is listened by broadcast?" -- correct. "do you have any other way to help me solve my problem" -- you could build your own file manager that offers a form of delete that supports this sort of "undo". Or, you could offer to contribute that support to existing open source file managers that do not offer this feature. – CommonsWare Jun 25 '23 at 10:53

0 Answers0