Search code examples
c++android-ndkaio

Is there asynchronous file i/o in Android NDK?


I had to save/load a lot of data stored at the sdcard in my C++ android-ndk code. However, I was told that there is no async file IO <aio.h> in Android NDK, is that right?

If so , can any of you give me an example (or guideline) of async read/write files in Android NDK? Thank you!


Solution

  • You are correct, there is no AIO available in the latest Android NDK:

    $ cd ~/android-ndk-r15/platforms/android-26
    $ find . -type f -exec grep aiocb {} \;
    $
    

    What is your primary use? Asynchronized reading or writing? You may have to roll your own solution with multiple threads.

    Or search github for existing solutions to portable async IO.