location

How to get the most accurate possible speed from GPS in Android

ぐ巨炮叔叔 提交于 2019-12-06 02:09:39
How can I get an accurate speed from GPS in Android? Yes, I am aware of the location.getSpeed() method in the Location class. Problem is, the default implementation returns 0.0 as speed: apparently that is the default behavior . What I'm currently doing, is as follows, consider location objects a and b, where a is taken first, b later: a.distanceTo(b)/(b.getTime()-a.getTime()); (simplified for readability, original code deals with history ArrayList ) Problem is that this is somewhat inaccurate: under normal circumstances, the data points are so close to one another that the GPS inaccuracy

How do I redirect to a mobile site but keep the hash tag?

泪湿孤枕 提交于 2019-12-06 01:51:08
问题 I'm looking to have it so that when a user loads our page it checks to see if they're on a mobile device and then it'll redirect them to a mobile version of our site, but keep the original hash tag from the link they followed. I've tried setting the new location with the hash tag in javascript and it works in Chrome but doesn't work in Safari. I've read that this is just something Safari does. Is there any work around to this? 回答1: You should escape '#' symbol and everything would be OK 回答2:

Get the last known location on Android synchronously

邮差的信 提交于 2019-12-06 00:55:21
What would be the "right" way to get the last known location on Android using LocationClient (v2 API) in a synchronous manner? UPDATE This is the best I've come up with (it's not synchronous but it overcomes the burden of dealing with connect() and onConnected() each time the last known location is needed): public enum SystemServicesNew implements GooglePlayServicesClient.ConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener { INSTANCE; private LocationClient mLocationClient; private Location mLastKnownLocation; static { INSTANCE.mLocationClient = new LocationClient(MyApp

Nginx配置文件说明

不羁岁月 提交于 2019-12-06 00:41:34
-- 重定向Nginx错误页面的方法 -- 在nginx的配置文件中,可以对发生错误是的重定向页面进行配置,在nginx.conf文件中有下面的配置信息: error_page 404 /404.html; 这个404.html保证在nginx主目录下的html目录中即可,如果需要在出现404错误后直接跳转到另外一个地址,可以直接设置如下: error_page 404 http://www.***.com; 同样的方式可以定义常见的403、500等错误。 特别注意的是404.html文件页面大小要超过512k,不然会被ie浏览器替换为ie默认的错误页面。 -- Nginx状态监控配置 -- 需要注意的是,Nginx默认安装不包含状态模块stub_status,所以,在编译Nginx的时候,需要添加以下参数: --with-http_stub_status_module 一旦包含stub_status模块后,我们就可以在配置文件nginx.conf中开启状态页面: http { server { listen 80; server_name localhost; location / { root html; index index.html index.htm; } location /nginx-status { stub_status on; access_log off;

Getting the location periodically and plotting markers to map

岁酱吖の 提交于 2019-12-06 00:34:23
I'm looking to create an app in android that basically tracks a phones location and periodically adds a marker to the google maps api so that a route can be displayed, the problem I have is that I don't know how to get the location periodically and in the background. Here is my code: public class MapsActivity extends FragmentActivity implements LocationListener { private GoogleMap mMap; // Might be null if Google Play services APK is not available. Button btnCurrent, btnPrevious; ArrayList<Double> latitude = new ArrayList<>(); ArrayList<Double> longitude = new ArrayList<>(); LocationManager lm

Android: Checking if google settings location is enabled

三世轮回 提交于 2019-12-06 00:14:26
问题 I'm working on an app that uses google play services. On Some phones, the client returns null for location. This happens because the locaiton option is not enabled on google setting as in the pic attached. How to programatically check if google settings location is enabled in an android app ? http://www.cnet.com/how-to/explaining-the-google-settings-icon-on-your-android-device/ 回答1: LocationManager lm = null; boolean gps_enabled,network_enabled; if(lm==null) lm = (LocationManager) context

How to zoom to fit in WP7 Bing Maps control using LocationCollection?

ε祈祈猫儿з 提交于 2019-12-05 23:13:51
问题 How can I zoom the Microsoft.Phone.Controls.Maps.Map control to the correct zoom level on Windows Phone 7? I have a LocationCollection of GeoCoordinates and I calculated the Center myself, but now how do I calculate the correct zoom level to fit the LocationCollection? P.S. Is there an out of the box method to calculate the center of GeoCoordinates so I don't have to calculate it myself? EDIT: I've found another fine solution: http://4mkmobile.com/2010/09/quick-tip-position-a-map-based-on-a

web应用中配置文件

我们两清 提交于 2019-12-05 22:58:11
NGINX配置文件 nginx.conf 1、nginx.conf结构分析 nginx配置文件中主要包括六块:main,events,http,server,location,upstream main 块:(全局设置)主要控制 nginx子进程的所属用户/用户组、派生子进程数、 events块:控制 nginx处理连接的方式 http块:是nginx处理http请求的主要配置模块,大多数配置都在这里面进行 upstream块:用于设置一系列后端服务器,nginx做反向代理、后端服务器负载均衡相关配置,可以有多个 server块:用于指定虚拟主机域名、IP和端口,可以配置多个虚拟主机 location块:是server中对应的目录级别的控制块,URL匹配特定位置后的设置,可以有多个 他们之间的关系式:server继承main,location继承server;upstream既不会继承指令也不会被继承。它有自己的特殊指令,不需要在其他地方的应用。 2、nginx配置命令解释 nginx中每条配置命令都必须要以分号“;”结束! user nobody; //配置nginx 子进程使用的用户和组 worker_processes 1; //配置nginx工作进程数,建议跟指定CPU数量一样多 error_log logs/error.log notice; //配置错误日志的存放位置

How to Detect Airplane Mode/ Flight Mode in IOS Swift

筅森魡賤 提交于 2019-12-05 21:35:30
问题 I need to detect weather IPhone is in Airplane mode or Not, i have done much research and i found no direct way to achieve that . My App has the functionality of Calling a Number and When an Iphone has Airplane mode he can't call. so I need to show him my custom Screen to Notify that Airplane mode is enable. it will be good if any one can explain how we can achieve it in an effective way. 回答1: Here is another way to detect this mode like below, go Info.plist -> add this **Application uses Wi

Get City Name From Latitude And Longitude in android Gives Service Not Available Android 4.0.3?

醉酒当歌 提交于 2019-12-05 21:35:12
I am using the Android 4.0.3 version in apps. Now I want to get the city name or other information from LATITUDE and LONGITUDE but when I run the apps is show me service not available. Logcat 01-10 13:58:29.279: W/System.err(1211): java.io.IOException: Service not Available 01-10 13:58:29.289: W/System.err(1211): at android.location.Geocoder.getFromLocation(Geocoder.java:136) 01-10 13:58:29.299: W/System.err(1211): at com.example.vixxa.VisitorActivity$CityAsyncTask.doInBackground(VisitorActivity.java:601) 01-10 13:58:29.319: W/System.err(1211): at com.example.vixxa.VisitorActivity