OnLocationChanged callback is never called

前端 未结 14 1450
星月不相逢
星月不相逢 2020-12-01 03:28

I am trying to get the users current location using the LocationManager. I have done a lot of research and can\'t seem to find anyone with the same problem. T

14条回答
  •  旧时难觅i
    2020-12-01 03:41

    LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    if (manager != null) {
            List providers = manager.getAllProviders();
            for (String provider : providers) {
               manager.requestLocationUpdates(provider, TIME_BW_UP, DISTANCE_BW_UP, locationListener);
            }
    }
    

提交回复
热议问题