geolocation

Geocoder initialization fails

帅比萌擦擦* 提交于 2019-12-11 15:07:21
问题 I am getting a NullPointerException when trying to declare the Geocoder in my application. I have the following declaration : public class MainActivity extends Activity { private Geocoder geocoder = new Geocoder(this, Locale.getDefault()); ... } I get the following LogCat : 03-20 10:48:55.729: D/AndroidRuntime(604): Shutting down VM 03-20 10:48:55.729: W/dalvikvm(604): threadid=1: thread exiting with uncaught exception (group=0x40a71930) 03-20 10:48:56.209: E/AndroidRuntime(604): FATAL

Get country code based on user's current location Android

末鹿安然 提交于 2019-12-11 14:48:59
问题 I have already tried out the following code to get country code name TelephonyManager tm = (TelephonyManager)getActivity().getSystemService(getActivity().TELEPHONY_SERVICE); String countryCodeValue = tm.getNetworkCountryIso(); But I guess this does not work if I want to get current country code in which the user is. For example if user travels from one country to another I want to get the country code in which he is in. I have a solution to get user's current country code but I am stuck: I

How to send Geolocation data from browser to server?

人盡茶涼 提交于 2019-12-11 14:44:31
问题 It seems that I need to run a function on client-side in browser, then send latitude and longitude to server in, for example, an ajax call then use the response data to reflect it on the page? So for that I need to add a new endpoint on server side just to manage such requests? Isn't it possible to get that data from inside the incoming request when a user loads some page? 回答1: As you already said yourself, the geolocation is running in Javascript on the client side. This gets executed when

Translate geo coordinates to address C# or jQuery

二次信任 提交于 2019-12-11 14:24:19
问题 In my jQuery code I can get user Geo coordinates. Now how can I translate GEO coordinates to an address either using C# or jQuery. 回答1: Try this using jQuery. Give Lat, Lng in text box and click GO. UPDATED <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Testing</title> <script src="scripts/jquery-1.9.1.min.js" type="text/javascript"></script> <script src="http:/

C# “await” error when using WinRT from Desktop app

陌路散爱 提交于 2019-12-11 14:18:14
问题 I trying to get my GPS position from a Desktop app, using Windows Runtime, in C#. I followed this how-to to set up Visual Studio and this code sample to create the following trivial code as a C# console app : using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.IO; using System.Runtime; using System.Windows; using Windows; using Windows.Devices.Geolocation; using Windows.Foundation; using

MapBox User Location Icon (Android)

旧街凉风 提交于 2019-12-11 14:15:10
问题 I use MapBox for my Android App, and I need to modify the standard blue "dot" that is used to indicate the current user location and orientation. I found this thread indicating that past MapBox Android APIs offered methods to modify the User Location Icon: https://github.com/mapbox/mapbox-android-sdk-legacy/issues/717 The thread mentions these methods: mapView.getUserLocationOverlay().setDirectionArrowBitmap(); mapView.getUserLocationOverlay().setPersonBitmap(); The newest MapBox Android SDK

Data type for storing latitude and longitude in oracle database

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 13:38:09
问题 I want to store latitude and longitude in oracle db. Which data type its good to use it for both these fields. I really appreciate for your reply. "latitude": 48.858844300000001, "longitude": 2.2943506, 回答1: Each column would be NUMBER(x+3,x) where x is the maximum number of decimal places you would ever wish to store (48.858844300000001 is VERY precise). 回答2: CREATE TABLE cola_markets ( mkt_id NUMBER PRIMARY KEY, name VARCHAR2(32), shape SDO_GEOMETRY); And for point CREATE TYPE sdo_point

Dynamically adding and removing segments from a track in OpenLayers 3

纵然是瞬间 提交于 2019-12-11 13:18:21
问题 I want to display a track in real-time with OpenLayers 3 which disolves at the end, just like a snails trail. Only appending new coordinates to a LineString is easy. See this example. But removing coordinates from the end of the line does not seem to be supported by the API. How should I go about that? Is extending the LineString class the only option? Or should I use a separate feature for each line segment? Update : I used this code with ol-debug.js. But get/setFlatCoordinates is not

How can i determine if location information returned by CLLocationManager is valid?

末鹿安然 提交于 2019-12-11 13:16:55
问题 How can I determine if location information returned by CLLocationManager is valid? 回答1: Two things to look for, the timestamp and the hdop (Horizontal Degree of Precision). The first one will tell you when the reading was taken, the second will tell you the level of error in the reading. For example a hdop of 1000 will tell you that the measurement is accurate to within 1000 metres. Obviously the lower the hdop the better. They are both in the Core Location update you get. 回答2: You can't be

how to notify the server every 5 minutes on user's location?

扶醉桌前 提交于 2019-12-11 12:57:27
问题 I write an android app. I want to send the server the user's location every 5 minutes even if he hasn't moved. how would you suggest me to do it? Using a Timer and just sending the location every 5 min or using locationListener with minDistance = 0 m and minTime = 5 min? 回答1: Write a AlarmManager that would wake up every 5 minutes and use LocationListener to get the current location to send to server. After sending location updates, just unregister(remove updates) the locationListener. In