Why not ask the owner of the public WiFi for the correct address?
Where did you get the idea that an access point can have 2 gateways: one to connect without Internet access, and a secret one with Internet access?
Okay, so there's an open wifi available. You're connected to it, as it's open, but it has no internet connection. The only way to get internet connection is to find its modified Gateway Address, modify and match it on your device. Now finding the Gateway from let's say 192.168.1.1 to 192.168.1.250 or sth like that takes a long time. Is there a way or a software to do that for you? A software where it will check all possible gateway addresses and find the one with the internet connectivity? Please help.