Athira
Athira

Reputation: 1213

Is there any listener for delete action from phone storage?

I want to know if there is any listener or method to know someone deleting any file from phone storage. When I delete anything I want to create a backup of those files.

Upvotes: 3

Views: 703

Answers (1)

Athira
Athira

Reputation: 1213

I have found code from File System Listener

new FileObserver(Your_path) {
    @Override
    public void onEvent(int event, String path) {
        if (event == FileObserver.DELETE)
          // File is deleted ,Do what you want
        }
    }.startWatching();

Upvotes: 2

Related Questions