IP address of device



I am working on a app that needs to verify access based on the ip address of the current device. I cant seem to find any help on how to get the IP address. Does anyone have some sample code on where to get this information from?


Platform: iOS and Android.