It really depends on the hardware but many smartphones do not have the capability of calculating an accurate GPS position while indoors. They will, however, often use other clues near your position such as well known WiFi networks to get an idea of your location.