According to the documentation, both FileObserver(path: String!) and FileObserver(path: String!, mask: Int) are deprecated (I don't know when). However, all other constructors were only added in API 29 (10/Q) and I'm trying to support from API 19 (4/KitKat) onwards.
What will be the alternative to monitor a file once these two constructors get removed in later APIs?
To answer this directly,
The new api requires a File type as the first parameter instead of a string. IE
FileObserver(File(path), mask)If you need to support APIs before and after deprecation, consider writing a wrapper function. Example (in kotlin)