I am trying to fetch location based on WiFi/3G/4G connection but it always returns 0.0 as latitude and longitude. If same code is used
WiFi/3G/4G
0.0
latitude and longitude
I think using FusedLocationApi would be a better solution see https://developer.android.com/training/location/retrieve-current.html
FusedLocationApi