Can Firemonkey Android openInputStream read zip files?

  

I have a Firemonkey Android app that launches with an intent after tapping a supported file type, in my case kml, gpx, kmz and zip files. It works fine with everything except zip files. For zip files, the InputStream read() returns 0 for every byte. available() returns the size of the zip file and the filename in my downloads folder provided by uri->toString() looks reasonable: content://com.google.android.apps.nbu.files.provider/2/340. I’m testing on a device running Android 9. I can just tap a filename for types except zip files. For zip files, I have to use menu "open with". As kmz files are basically zip files with a different extension, and kmz files work here, I’m wondering if Android processes zip files differently. Thanks in advance for any enlightenment from the stackoverflow brain trust.
Androidapi::Jni::Net::_di_Jnet_Uri uri = intent->getData();
Androidapi::Jni::Javatypes::_di_JInputStream InStrm = TAndroidHelper::Activity->getContentResolver()->openInputStream(uri);
if (InStrm != NULL)
{
int siz = InStrm->available();
if (siz > 0)
{
// Android docs say available() may be less than the actual file size, but I’m hunting for clues here
for (int c = 0; c < siz; c++)
{
byte b = InStrm->read();
// Process byte b
}
}
}

Comments are closed.