Android Question File.exist that was created by another service

Rusty

Well-Known Member
Licensed User
Longtime User
I have an app that looks for a file created by a service.

Service Code:
B4X:
       InstallFiles = File.ReadList(File.DirRootExternal, UpdateFiles)
       InstallFiles.Add(Item)
       File.WriteList(File.DirRootExternal, "test.txt", InstallFiles)   'write the list back to the file

in the application:
B4X:
If File.Exists(File.DirRootExternal, "test.txt") Then
        ...do something
    End If

The service creates/writes data into the file successfully.
Simultaneously, the application is running and periodically it checks for the existence of the file. If it exists, it reads it and process it.
However, frequently the service creates the file; the application code (above) does NOT see the existence of the file and therefore fails to process it. (The file IS there if you look from the PC, you can see it. USB connection)
Is there a cache problem or some other reason the app doesn't see it? If so, what might the resolution be?
Thanks in advance,
Rusty
 

Rusty

Well-Known Member
Licensed User
Longtime User
The application already does this with no help...
However, I created a broadcast message from the service to the application that seems to help.
If the application starts from scratch after the service has created the file, it works great. The problem only exists when the application is running and the service creates the file.
Thanks Erel
 
Upvote 0
Top