location

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

风流意气都作罢 提交于 2019-12-01 07:01:25
问题 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

Android Location service didn't work in background

落爺英雄遲暮 提交于 2019-12-01 06:51:53
问题 I am working on a Location-App which should begin to track some statistic data based on longitude and latitude when the user presses a Button . All this stuff works very well but when it comes to lock the screen or put the app in the background the service does not work anymore ! I have read a lot about background services and Broadcast receivers but I don't know how to implement the Google API Location listener in a Service and where to implement this class in the MainActivity . Can anyone

Is it possible to know my location came from gps or glonass?

风格不统一 提交于 2019-12-01 06:16:05
Suppose the device support both gps and glonass(support at the hardware level). Now when I get location by the android.location API, is it possible to know the hardware where the location came from? LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, new LocationListener()); class LocationListener implement LocationListener(){ @Override public void onLocationChanged(Location location) { GPSStatus status=locationManager.getGpsStatus(); //check the PRN of the satellites from the

Location returns 0.0 with WIFI/3G/4G in Lollipop 5.0.2

允我心安 提交于 2019-12-01 05:51:56
问题 I am trying to fetch location based on WiFi/3G/4G connection but it always returns 0.0 as latitude and longitude . If same code is used with GPS ON then it works so something is changed from 4.4 onwards. Also tried following link but its not working too. http://www.androidhive.info/2015/02/android-location-api-using-google-play-services/ public class GPSTracker extends Service implements LocationListener { private static final String TAG = "GPSTracker"; private final Context mContext; boolean

Android - Network Date/Time

落爺英雄遲暮 提交于 2019-12-01 05:49:02
问题 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! 回答1: GPS or Network

DDMS not able to send location to emulator

孤者浪人 提交于 2019-12-01 05:44:15
DDMS is not able to send location to the emulator. I have tried sending just the location from DDMS but still the emulator is not able to receive location. The application works properly in the device but its not able to capture location data in the emulator. I am testing on Android 2.2 emulator. Can anyone let me know what can be the issue? I just use the android console via telnet, it always works. Just open a command line and: telnet localhost 5554 5554 is the port number of your emulator, it is usually that but might change, it can be on the window fram of the emulator as PORT:AVD_NAME.

Nginx的基本安装配置

孤街醉人 提交于 2019-12-01 05:42:00
Centos7安装nginx 升级nginx 升级可能遇到问题(我没有遇到, 参考的另一篇文章描述的) 检查nginx版本, 确认安装成功 nginx配置文件 虚拟主机配置 配置文件中可以用的全局变量 常用正则 Centos7安装nginx 设备联网的前提下,直接可以通过yum安装 # 添加软件源 rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/ # yum repolist 查看可以查看yum源 nginx-release-centos-7-0.el7.ngx.noarch.rpm yum install -y nginx 升级nginx yum list |grep nginx 查看列表中存在的稳定版本的nginx yum update nginx 升级nginx nginx -s reload 重启nginx 升级可能遇到问题(我没有遇到, 参考的另一篇文章描述的) 可能出现: nginx: [emerg] module "/usr/lib64/nginx/modules/ngx_http_geoip_module.so" version 1012002 instead of 1014002 in /usr/share/nginx/modules/mod-http-geoip.conf:1 运行下面的命令:

jQuery.extend函数详细用法!

好久不见. 提交于 2019-12-01 05:37:11
1、扩展jQuery静态方法. $.extend({ test:function(){alert('test函数')} }) 用法: $.test() 2、合并多个对象. 为jQuery.extend(css1,css2)为例,css1,css2个有一些属性(法照样会比处理,这里之讲属性). extend函数会把css2有而css2没有的属性加到css1中,如果css2的某个属性与css1的某个属性名称享用,就会用css2的属性去覆盖css1的同名属性。css1就是最后的整和对象。或者也可以用 : var newcss = jquery.extend(css1,css2) newcss就是合并的新对象。 var newcss = jquery.extend({},css1,css2) newcss就是合并的新对象.而且没有破坏css1的结构。 //用法: jQuery.extend(obj1,obj2,obj3,..) var Css1={size: "10px",style: "oblique"} var Css2={size: "12px",style: "oblique",weight: "bolder"} $.jQuery.extend(Css1,Css2 //结果:Css1的size属性被覆盖,而且继承了Css2的weight属性 // Css1 = {size:

Enable Location/GPS settings without using Play Services API

我是研究僧i 提交于 2019-12-01 05:33:01
As most of you might already known there is a new Location Settings Dialog API in Google Play Services. For those who don't know here is the screenshot of Maps app which used Dialog API in action. It is kinda unfair that google only added that API inside their play services. On the other hand, I think if they could do it, there would be a workaround to do it. That's why I am asking this question. Any information is appreciated. (Note: There was an exploit which let developers to enable and disable gps/location setting programmatically. However those tricks available on SO no longer works.

How to set “Types” in Google Place PlacePicker in Android?

南笙酒味 提交于 2019-12-01 03:58:24
In the new google places API, they come with a new feature called PlacePicker. It's a simple activity to select a place of the list/map of places they have. In the Places API we can give a types list, to receive only places of those specific types. I'm building an app that uses only "establishment" places. But this activity shows all the places, including a lot of places that i do not need (libraries, schools, gas ...) There is a way to set the types of the PlacePicker? Reading the API docs doesn't say nothing about. Currently it seems not to be possible. There is an open feature request ,