Created
March 28, 2018 11:04
-
-
Save dawidstrom/cbc708753b7994f26c66c1ae5c7feb04 to your computer and use it in GitHub Desktop.
init
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File recides in external public storage /Documents/file.txt, I've checked this is the actual file being looked at. | |
filePath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath()+"/file.txt"; | |
// Have tried CREATE and CLOSE_WRITE, none of them triggers when I transfer file.txt to Documents using MTP transfer on windows machine. | |
MyObserver observer = new MyObserver(filePath, FileObserver.CREATE, this); | |
observer.startWatching3(); | |
/* This works correctly if the file exists. | |
if (new File(file).exists()) | |
observer.onEvent(1, "") // Dummy values. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment