Same process as Google Authenticator for Gmail. There is no internet connection required to get the passcode via your app. The app generates the number and through the magic of computers the website knows what code is currently being generated for you.
Your Gmail account is much more secure if you use this process. The password storage app LastPass also can use the same type of security and I highly recommend the app.