I have had much problems of that nature.
I have posted several times about it.
I have used various phones and tablets with Android 4.4 through 9 and the behavior is much the same.
I have done extensive testing with a few units as follows:
The access point is actually a small WiFi module from China,
model USR-C215 and USR-WIFI-232T. They behave essentially the same.
https://www.usriot.com/products/iot-wifi-module.html
They can be configured to be an access point or to join a network. I typically use them as access point and connect the phone or tablet to it. Then I can easily run TCP or UDP packets between the two reliably
as long as I am at home or within range of an Internet connected access point.
This is the weird part: as long as the Android device sees another access point in range that has internet access, it will stay connected to the wifi module (even though it is not connected to the internet).
I actually control my home lights like this and have been for several months. I use two older phones (Motorola Droid Razr, Android 4.4) as control units and the USR-C215 module is connected to an 8051 microcontroller which controls the lights (I had an old low voltage lighting system made by Touch-Plate that was not working right). No internet access and the phones stay connected for ever and even reconnect automatically when power goes down. The phones are NOT configured to access my home router, so they have no internet access, but the router is in range of the phones.
I use the same modules to remotely control training systems I sell. Similar configuration, an Android tablet and the WiFi module connected to an 8051.
However, if I take a phone and one of my WiFi equipped training system in the car and drive out of town, the phone will disconnect from the WiFi module after a few seconds and will not reconnect unless I reboot the phone. Then it will reconnect for a few seconds again and disconnect.
When I drive back in town, as soon as I am in range of any WiFi access point (like the local college or anywhere in my street), I can reconnect and stay connected to my WiFi module. Of course, these access points are protected and I do not have password, so there is no way the phone can actually get any internet traffic through it.
I have tried all types of keep-alive methods I could think of, nothing seems to fix it. Obviously, the fact that I need to drive out of town to try any fix does not help.
So for now, the fix has been to use Bluetooth for these systems that have to operate in the country. I started with the HC-05 modules and now I am switching to the JDY-30/JDY-31 which are easier to configure and seem to work even better than the HC-05. I have a review and a translation of the Chinese datasheet and command set
here.
The range is quite good (not as good as WiFi but sufficient for most of my needs) and solving the disconnect problem has been a godsend. Being able to stay connected to the internet through WiFi at the same time I am controlling my modules through Bluetooth is also a convenience for me when I test these systems at home.
My lights controller still uses WiFi because I need the range (the WiFi module is in the attic of a 2 story house, out of range for Bluetooth) and it works (I have no interest in controlling my lights through the Internet per se, just eliminating the old Touch-Plate system was my goal)
The last test I need to do is with the iPhone. I do have the B4I license and paid my Apple developer's tax and I need to try that before it expires... Of course, with the iPhone, there is no Bluetooth option (except for BLE but I have not gotten that working to my satisfaction yet).