Would not a better solution be to ping a resource on the application server rather than an external resource (in this case Google)?
If the resource can't be pinged, it means either the user is offline or the app is down which are essentially the same thing for your app in most cases, while in your implementation, it could just mean Google.com is down (There is very low chance of this happening. Still..)
If the resource can't be pinged, it means either the user is offline or the app is down which are essentially the same thing for your app in most cases, while in your implementation, it could just mean Google.com is down (There is very low chance of this happening. Still..)
EDIT: Made the second paragraph clearer.