Normally the data sent to esp module is done using web client for that you need to get connected to a local network but as you want to pass the ssid and password from the mobile is bit difficult. You can opt for for this method according to me as you cans save the ssid and password of the frequently used wifi's which you are using now when your esp will get turned on automatically it will search for the given ssid's as you can connect your phone also with same wifi and you can establish your connection using client server tcp ip method or simple web server method using port 80.