In my app I am receiving data at onReceive()
of various Broadcast receivers. I need to write the intent data I receive into a single file. Every time I receive an intent at any of 4 broadcast receivers I open the same file to write and close it. Sometime many onReceive()
are invoked and I need to.
I want to know what is the best mechanism for writing to file. I explored on synchronization, use of Queue
etc. But these were good mechanism for writing from multiple threads.
So my Question is each onReceive()
equivalent to a thread here?
If yes which mechanism is best to write to a single file on SD card.
If no, Just a regular write is fine(without any locking/synchronization etc)