location

Location service onProviderEnabled never called

一笑奈何 提交于 2019-12-01 09:49:08
问题 I have a service to update location in my app. When I start my app with GPS disable, go back to android menu and enable GPS, and finally go back to my app (the service has not been destroyed), onProviderEnabled is never called. Anybody could help? UPDATE: if I restarts the app the provider is enabled. Only onProviderEnabled is not called... In every activity in which I need location I do super.onCreate(savedInstanceState); //.... // Bind location service bindService(new Intent(this,

新手学分布式-动态修改Nginx配置的一些想法

╄→尐↘猪︶ㄣ 提交于 2019-12-01 09:33:27
本人是分布式的新手,在实际工作中遇到了需要动态修改nginx的需求,因此写下实现过程中的想法。Nginx功能强大且灵活,所以这些权当抛砖引玉,希望可以得到大家的讨论和指点。(具体代码在 https://andy-zhangtao.github.io/nginx2svg/ ) 如何动态配置Nginx参数 Nginx参数众多,并且配置是非灵活,因此要达到完美的自动化配置是一件很有挑战性的事情,这个工具并不能十分完美的自动化调整参数。目前支持自动化修改的参数有: server upstream proxy_pass root 下面将介绍 Nginx2Svg 是如何实现自动化修改参数的。 预备知识 为了更好的理解 Nginx2Svg ,需要一些很简单的预备知识。 首先需要了解Nginx的配置文件格式,一个典型的Nginx配置文件(假设此处Nginx作为7层反向负载使用)看起来应该是下面的样子: # 抄自nginx官网 http://nginx.org/en/docs/example.html 1 user www www; 2 3 worker_processes 2; 4 5 pid /var/run/nginx.pid; 6 7 # [ debug | info | notice | warn | error | crit ] 8 9 error_log /var/log/nginx

Latitude and Longitude showing as 0 in Android

▼魔方 西西 提交于 2019-12-01 09:29:29
************* TrackGPS.java ***************************** import android.app.AlertDialog; import android.app.Service; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.os.IBinder; import android.provider.Settings; import android.support.v4.app.ActivityCompat; import android.util.Log; import android.widget.Toast; /** * Created by ANQ on 8/8/2016.

activate tab based on the # hash in the url

感情迁移 提交于 2019-12-01 09:28:13
Say i had a URL such as the one below...how can i activate the correct tab? http://domain.com/safety.php#tabOne Heres my HTML: <div id="tabsWrapper"> <div class="tabMenu"> <ul class="tabset"> <li><a class="tab active" href="#tabOne">Safety First</a></li> <li><a class="tab" href="#tabTwo">BS8848 & LoTC</a></li> <li><a class="tab" href="#tabThree">Know Before You Go</a></li> </ul> </div> <div id="tabbedContent"> <section class="contentTab" id="tabOne" style="display: block;">Content here</section> <section class="contentTab" id="tabTwo"> <h3 style=""></h3> </section> <section class="contentTab"

[问题记录]按url context path设置nginx反向代理禅道和Jenkins

↘锁芯ラ 提交于 2019-12-01 09:23:15
问题 : 在公司同一台服务器上分别装了禅道的开源版(linux一键安装)和Jenkins(docker),觉得带端口号的链接给上头leader等使用有点难看……就想改成用二级url区别的方法,即目标是: 由 dev .server .com : 8001 改成用 dev .server .com /zentao 访问禅道 由 dev .server .com : 8002 改成用 dev .server .com /jenkins 访问Jenkins 然后简单搜索了下、写出了下面的( 有错误的 )nginx配置: server { listen 80 ; server_name dev. server .com; location /zentao { proxy_pass http: //localhost:8001; } location /jenkins { proxy_pass http: //localhost:8002; } } 按上面/zentao、/jenkins这样的新路径,禅道一下子就打开了用户登录界面,但是Jenkins却是404。 原因 : 原本以为Jenkins不能用很奇怪,最后发现禅道能用只是碰巧…… 为什么打不开Jenkins? 首先发现如果使用端口号访问的方式、浏览器会自动跳转至Jenkins登录界面、url发生了变化,于是联想到比较下不同的url访问

Android - Network Date/Time

旧巷老猫 提交于 2019-12-01 08:37:26
I'm in the process of writing an app for Android. I need to allow my users to capture their current location & log the date/time that this happened. The catch is that the date/time cannot be something that the user can change by adjusting the date/time on their device. Can you point me in the right direction for obtaining the Cellular Network date/time when using location services for towers, and also how to obtain the GPS date/time. Any help is appreciated, thank you! Sean Barbeau GPS or Network timestamp can be retrieved by using the LocationListener in the Android Location API. See the open

Foreground service not receiving location updates in Doze mode in Android O

╄→尐↘猪︶ㄣ 提交于 2019-12-01 08:21:18
I have a foreground service that needs to get a single location update. It is started by a specific broadcast, and upon starting it simply does a request on our backend. When it receives another broadcast, it requests a location update (once), does another backend request and then stops itself. Edit: to clarify, the service itself does the location updates and backend requests. It is independent from the main app in that regard. This works well on Lollipop and Marshmallow, both when the phone is awake or in Doze mode. But for some reason, on Android O the service never gets location updates

Grey GPS arrow shown in statusbar although location based application killed using Fast App Switcher

て烟熏妆下的殇ゞ 提交于 2019-12-01 08:20:28
I am writing a location based application for iOS 5. The application is using the CLLocationManager to receive Location updates. When the application is started I am creating the LocationManager, calling [self.locationManager startUpdatingLocation]; and the grey location arrow appears in the statusbar. When the application enters background I am calling [self.locationManager stopUpdatingLocation]; [self.locationManager startMonitoringSignificantLocationChanges]; cause I just want to receive significant location changes while the app is in background. The grey location arrow is still shown. I

Android real-time Google Maps location tracking

≡放荡痞女 提交于 2019-12-01 07:35:01
问题 I am working on an Android app where players battle each on their phones in real-time based on their location. On Google maps, you can see where you are, in what direction you are facing, and where you are moving, all from a little blue dot. My question is: How can I integrate something like that in my app, so when the player moves, you can see it on the Google Maps fragment? Edit: Currently, my application drops a new pin every time your location updates. I'm looking for something that moves

Android LocationClient.getLastLocation() returns old and inaccurate location with a new timestamp

*爱你&永不变心* 提交于 2019-12-01 07:33:45
I've been using the fused location provider since its release and I am pretty happy with it (way better than the old system). But I ran into a peculiar problem when using geofencing in combination with LocationClient.lastKnownLocation(). The setup is as follows: I drop several geofences around some home location (with increasing ranges). When I get the intent that a fence is crossed I retrieve the last known location from LocationClient and work with it. Apart from than I also registered for regular location updates with update mode PRIORITY_BALANCED_POWER_ACCURACY. Most of the times this