I need to know the IP address of ESP32 on the local network(without printing ip on serial monitor ). The idea is to do mDNS or UDP broadcast to send the IP to the android application. The app will then use that IP to do the communication. Is there someone who has already done it?
You don't. You configure mDNS (as you already suggested in your question...!) and the client device then queries mDNS to find the device by the name you allocated it.
Look at the ESPmDNS library examples for how to use mDNS.
Edit: if you really want the IP, you can do
WiFi.localIP() (station mode) or
WiFi.softAPIP() (access point mode).