locationmanager

How to use Android LocationManager and Listener

北战南征 提交于 2020-01-22 10:33:46
问题 I'm not having any luck receiving any data from the GPS using the code below, and i'm not sure what I'm doing wrong, it seems like my code matches everything i see online. i'd like to eventually add this to a background service to log gps coordinates even when the activity isn't visible or if other apps are open and if the speed is greater than a certain defined amount, but at this point I can't even get any of the data to show up. i'm relatively new to android but i can't figure out what am

How to use Android LocationManager and Listener

百般思念 提交于 2020-01-22 10:33:08
问题 I'm not having any luck receiving any data from the GPS using the code below, and i'm not sure what I'm doing wrong, it seems like my code matches everything i see online. i'd like to eventually add this to a background service to log gps coordinates even when the activity isn't visible or if other apps are open and if the speed is greater than a certain defined amount, but at this point I can't even get any of the data to show up. i'm relatively new to android but i can't figure out what am

LocationManager uses FusedLocationProviderApi?

和自甴很熟 提交于 2020-01-17 14:57:19
问题 During researching I realized that there are different ways in Android to get the users location. First solution is by LocationManager and the second solution is FusedLocationProviderAPI, which is based on GooglePlay Services. In the internet I just could find tutorials & explanations of them separately. At work today somebody showed me that he is using LocationManager with Criterias that in the onLocationChanged-Method locations are received with the provider "fused". Does this mean that

android - Get location and send data to remote server ONLY while condition is true

爷,独闯天下 提交于 2020-01-14 05:25:12
问题 I am building an app that needs to send the user's location to a remote server (Pusher in this case). The goal is to update their location on a map in near real-time but only when they are on a job, otherwise the app will not need to track their location. I need the location updates to remain active if they leave the activity where they accepted the job (and therefore were placed on the map) and if they leave the app altogether. Once they have reached their destination, I wish to stop this

different behaviour for current location latitude and longitude in iOS7 to IOS8

两盒软妹~` 提交于 2020-01-13 20:30:07
问题 Using xamarin for current location currentLocation example I used the above Link for getting current location latitude and longitude. In IOS 7 before upgrade to IOS 8 Its shows my current location latitude and longitude on both simulator and device.(Its looks strange for me in simulator for getting current location latitude and longitude). After upgrade to iOS 8 and run same code it give In simulator:(Turn on wifi no sim card location service App always.) Result: latitude = 37.785834.

android locationManager requestLocationUpdates

若如初见. 提交于 2020-01-13 07:23:30
问题 Is there a way to request location updates from a locationManager at specific intervan and to ignore minDistance? I've tried locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 3600 * 1000, 1, this) But in logs appears sometimes that location is updated in a few minutes, sometimes in a half of hour... Can this be done to update location at a fixed interval and to ignore distance? 回答1: You can use this schema. Create new Runnable which will be called every time, when you want

iphone core location: distance filter how does it work?

江枫思渺然 提交于 2020-01-12 03:55:11
问题 What exactly the property locationmanager.distancefilter do? Does it determine how often the didUpdateTolocation method gets called?? 回答1: It filters out short moves. So if CL detects that the device moved 20 meters, but your distance filter is set to 30m you will not be notified. Once the position has moved enough to exceed your distance filter setting then you will get a didUpdateToLocation callback. It is very common for GPS position results to wander even when a device isn't moving. You

android.os.NetworkOnMainThreadException. How to solve it?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-11 14:43:33
问题 I am trying to get my current location and get the driving directions to some destination. I am able to get my location and when I execute the code for the driving directions I get android.os.NetworkOnMainThreadException in the following line HttpResponse response = httpClient.execute(httpPost, localContext); Response is NULL. What do i do ? public Document getDocument(LatLng start, LatLng end, String mode) { String url = "http://maps.googleapis.com/maps/api/directions/xml?" + "origin=" +

“location provider requires ACCESS_FINE_LOCATION permission” even if I use runtime request permission

落花浮王杯 提交于 2020-01-06 05:26:09
问题 This is so weird. We all know that if <uses-sdk android:targetSdkVersion="23"/> is set to 23+, you must ask for runtime permissions besides declaring <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> in the manifest. This has been working with no problem for years. Now, The problem is that when I am setting targetSdkVersion to "26", the LocationManager is not working anymore! and throws this error: "gps" location provider requires ACCESS_FINE_LOCATION permission The

getLastKnownLocation() returns null even with best provider

喜欢而已 提交于 2020-01-05 07:49:29
问题 This is the Code I use to get the current location: mgr = (LocationManager) getSystemService(LOCATION_SERVICE); Criteria criteria = new Criteria(); best = mgr.getBestProvider(criteria, true); if (best == null) { //ask user to enable atleast one of the Location Providers } else { Location location = mgr.getLastKnownLocation(best); //But sometimes it returns null } Almost everytime best = network But it's not providing the location sometimes. mgr.getLastKnownLocation(best) returns null Also: