How to check location setting On / OF

Is there way to check location sensor ON or OFF?
if (location off)
show msg
else
hide msg