How to get a reference to LocationManager inside a Fragment
inside your fragment simply call this:
LocationManager mgr =
(LocationManager)getActivity().getSystemService(Context.LOCATION_SERVICE);
So you simply get the Activity and call getSystemService()
from there
Edit:
As the getActivity
method is deprecated since API 28 you can just use:
LocationManager mgr =
(LocationManager)getContext().getSystemService(Context.LOCATION_SERVICE);