location

Unable to retrieve location using 'LocationManager.NETWORK_PROVIDER' even when WiFi is enabled in device running android M

此生再无相见时 提交于 2019-11-29 17:26:21
I'm trying to retrieve location using LocationManager following this tutorial. I'm running the code on an android device running Marshmallow and I have checked the permission and running below code once the permission is granted. Here's my code: public Location getLocation() { try { locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); // getting GPS status isGPSEnabled = locationManager .isProviderEnabled(LocationManager.GPS_PROVIDER); // getting network status isNetworkEnabled = locationManager .isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (!isGPSEnabled &&

How to populate an array with information from JSON File and calculate distance?

强颜欢笑 提交于 2019-11-29 17:25:52
I have a JSON File here: { "People": [{ "A1": "New York", "B1": "ShoppingMall1", "C1": "43.0757", "D1": "23.6172" }, { "A1": "London", "B1": "ShoppingMall2", "C1": "44.0757", "D1": "24.6172" }, { "A1": "Paris", "B1": "ShoppingMall3", "C1": "45.0757", "D1": "25.6172" }, { "A1": "Bern", "B1": "ShoppingMall4", "C1": "41.0757", "D1": "21.6172" }, { "A1": "Sofia", "B1": "ShoppingMall5", "C1": "46.0757", "D1": "26.6172" } ] } and from this JSON File I have to take the names and the coordinates of the shopping malls and populate them into an array. This array I want to use in Table View Cells. The

android check location services enabled with play services location api

若如初见. 提交于 2019-11-29 16:09:03
问题 You can determine if any providers are available with LocationManager, but can it be done with the google play services location api? When nothing is enabled, in fact "access to my location" is off, all the API calls (connect(), requestLocationUpdates()) succeed, but you never get an onLocationChanged(). Seems silly to have to use both LocationManager and the LocationClient. I guess what I need is some way to know that onLocationChanged(0 will never get called. 回答1: I've combed the docs and

android check if user turned off location

旧街凉风 提交于 2019-11-29 16:02:47
I am building an application in which I have to constantly save user's location and then send it to the server. For that, I am using FusedLocationApis in a service. For the first time, I am asking user to turn on locations. It is working perfectly. Now, what if the user unintentionally turns off the location. How should I inform him? Do developers have to take care of this or they just leave it to the user? I thought of giving him an android notification for this. For that, I need to constantly check our locations enabled in the service. I have a working code for that (function

Significant Location Changes - What guarantees do we have?

一曲冷凌霜 提交于 2019-11-29 15:39:52
问题 I'm currently writing a Mobile iOS app that is using the iOS Significant Location Change service to manage lots and lots of geofences, enabling and disabling geofences as we receive this message from the CoreLocation Framework. On the Apple Developer Website it says: The significant-change location service delivers updates only when there has been a significant change in the device’s location, such as 500 meters or more. What really throws me off is "500 meters or more", what exactly is the

Finding nearest street given a lat-long location

旧巷老猫 提交于 2019-11-29 14:35:35
问题 Is there any such API where given a location (in terms of latlong), I could find whether the given point is on road/street or not. And if possible also gives me nearest street/road to that location. I found API from [Find nearby Streets] -> http://www.geonames.org/maps/us-reverse-geocoder.html#findNearbyStreets , but it just gives solution for US. Help me if u know of any better solution/algorithm. ( I am particularly interested in India.) 回答1: You can use the Google Maps Geocoding API which

Nginx部署!

旧巷老猫 提交于 2019-11-29 13:23:06
一:使用Nginx搭建虚拟主机服务器时,每个虚拟WEB站点拥有独立的"server {}"配置段,各自监听的IP地址、端口号可以单独指定,当然网站名称也是不同的。 二:虚拟机的分类: 1:基于域名虚拟主机(一个ip地址对应多个域名,不同域名就是不同的站点,其内容也不一样) 2:基于端口虚拟主机(服务器只有一个ip地址,不同端口就是不同的站点,其内容也不一样) 3:基于ip虚拟主机(服务器有多个ip地址,不同ip就是不同的站点,其内容也不一样) 二:nginx -t 用于检测配置文件语法 如下报错1:配置文件43行出现错误 [root@www ~]# nginx -t nginx: [emerg] "location" directive is not allowed here in /usr/local/nginx/conf/nginx.conf:43 nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed 如下错误2:worker里面工作区出现问题 [root@www ~]# nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: [warn] 10240 worker

ForegroundService on android Oreo gets killed

杀马特。学长 韩版系。学妹 提交于 2019-11-29 12:54:19
I'm trying to build up a service which requests the device location every minute. I need this to work in background even when the application is closed. So far I managed to make it work on devices which has a pre-Oreo android OS but now I'm testing the service on android Oreo device and is not working when I close or put the application in background. In my research I found that for Oreo devices a Foreground Service with an ongoing notification should be used to achieve this so to start with I've implemented a simple Foreground Service like the below which while started it shows an ongoing

Android Geocoder behaves different on some devices

不羁岁月 提交于 2019-11-29 12:54:13
I have the below code, it works perfectly on some devices and in others the function getFromLocationName return a list with size 0. For example, in Nexus 6p it returns the correct result and in Meizu MX5 it returns a list with size 0. I have the same permissions and GPS enable for both devices. Android version on the Nexus 6p is 7.1.2 and on Meizu MX5 is 5.1 Geocoder geocoder = new Geocoder(context); List<Address> addresses = geocoder.getFromLocationName(place, 3); Notes : place is the location the user entered (String). Geocoder is from android.location.Geocoder; So why the difference? Is it

how to get latitude/longitude from one geo address using Qt c++ on windows?

核能气质少年 提交于 2019-11-29 12:53:38
Its is possible get the coordinates(latitude and longitude), of a geo location using just the geo address (country, state, city, street, etc...), on Qt c++? I know the libraries QGeoCoordinates, QGeoLocation and QGeoAddress, but i don´t know if is possible get coordinates from an address through them. Every help is welcome. I needed some time to master this but finally I got it working. At first I tried the classes mentioned by you: QGeoAddress , QGeoLocation , QGeoCoordinate : // standard C++ header: #include <iostream> // Qt header: #include <QGeoAddress> #include <QGeoCoordinate> #include