location

Android Location listener is not working

放肆的年华 提交于 2019-12-24 11:04:33
问题 I would like to get current device location and open Google Maps with this: if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); LocationListener locationListener = new MyLocationListener(); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 10, locationListener); } else { ActivityCompat

Trace the location only on Road in Google maps V2 android

末鹿安然 提交于 2019-12-24 10:48:07
问题 I want to show the current location of the user only on road(not beside of the road) while moving. I have used the LocationManager to get the current location. But sometimes I am getting the location beside the road, with this, the location point on map is showing beside the road. Actually, I have to show his location on Road(if he is beside the road) only. I searched lot for this but didn't get any idea. Example: How I am getting the current locations on map. m A---n-------B here, A is start

objective-c source locationManager out in own class

怎甘沉沦 提交于 2019-12-24 10:45:06
问题 I want to source the locationManager out in an own class that I can call from different other classes. What I did. Created an iPhone Application, and added the locationManger code in the ViewController. Worked. Now I created a class Lokation where I shifted all locationManager Code to this new class and called that code from the ViewController. Result: The function getLocation is called but locationmanager:manager didUpdateToLocation:newLocation fromLocation:oldLocation is not called. Output

Why getBaseStationLatitude() keeps returning the Integer.MAX_VALUE (unknown)?

╄→гoц情女王★ 提交于 2019-12-24 09:58:04
问题 Class project & thesis work - trying to pull information from CDMA Cell, specifically by using the getBaseStationLatitude() & getBaseStationLongitude(). The value being returned is the MAX_VALUE (2147483647) - I'm not receiving actual lat/longs. getBaseStationID(), getNetworkID() & getSystemID() are returning valid id's. I've tested this in 2 separate cells with no luck. My code is posted below. Both ACCESS_FINE_LOCATION & ACCESS_COURSE_LOCATION are added to manifest. Testing done on Droid,

Android get User Location once

你。 提交于 2019-12-24 09:56:11
问题 I know that there are a lot of things around this but even after I read them all (almost) I still can't figure it out the issue. Basically I want to get the user FINE LOCATION when I open the app or press a button and save on Shared Preferences. My old code worked but since was slow to get the coordinates, it fails to save on sharedpreferences (GPS icon don't show on bar). OLD: public void askLocation() { if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.ACCESS_FINE

How to normalize city name from many similar names

瘦欲@ 提交于 2019-12-24 09:41:10
问题 I'm getting city name from a 3rd party API. That API doesn't return normalized city name. For example, sometimes its San Francisco , sometime its San Francisco, CA , sometimes its San Francisco, USA . I dont need street address etc.. I just need to normalize the city name to be something uniform. I'm looking for a service that could help me with this requirement. P.S: Its not mobile app, its web app and the location doesn't come from the browser. 回答1: You can use the Google Maps API to get

windows phone map control show all locations (zoom to include all pushpins)

百般思念 提交于 2019-12-24 07:15:34
问题 I've tried using map.SetView(LocationRect.CreateLocationRect(locations)); But the thing is I need the all the pushpins to be shown as well. Using the above method only takes the location into account. Some pushpins gets cropped especially corner ones. Is there a better way to do this? Thanks. 回答1: LocationRect.CreateLocationRect(locations) gives you the binding box of the locations, so you could artificially inflate that a little (for example, by adding/subtracting a tenth of a degree from

js判断PC端和移动端

穿精又带淫゛_ 提交于 2019-12-24 06:49:37
var sUserAgent = window.navigator.userAgent.toLowerCase();//获取浏览器信息 var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; //ipad var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";//iphone var bIsMidp = sUserAgent.match(/midp/i) == "midp";//移动设备 var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";// var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";//ucweb浏览器 var bIsAndroid = sUserAgent.match(/android/i) == "android";//android var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce"; //windows ce移动系统 var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";/

window.location对象详解

此生再无相见时 提交于 2019-12-24 06:17:09
window.location.href(当前URL) 结果如下: http://www.myurl.com:8866/test?id=123&username=xxx window.location.protocol(协议) 结果如下: http: window.location.host(域名 + 端口) 结果如下: www.myurl.com:8866 window.location.hostname(域名) 结果如下: www.myurl.com window.location.port(端口) 结果如下: 8866 window.location.pathname(路径部分) 结果如下: /test window.location.search(请求的参数) 结果如下: ?id=123&username=xxx 通常由于业务需要,前端页面中的某个数据源来源,需要我们去获取URL的某个参数值。这时封装一 个输入参数名获取对应参数值 的函数是必不可少的,如下所示: function getQuery(name) { // 正则:[找寻'&' + 'url参数名字' = '值' + '&']('&'可以不存在) let reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); let r = window.location.search

Android location update with fusedApi, only if am moving

ぃ、小莉子 提交于 2019-12-24 04:53:15
问题 How to get location update for every 1000 meter,ie update only if am moving ,with fused api integration. 回答1: When you are building your LocationRequest to be used by the FusedLocationApi you can use the method setSmallestDisplacement(...) as specified in the documentation like below: locationRequest.setSmallestDisplacement(1000); Note that the argument is in meters. 来源: https://stackoverflow.com/questions/35249408/android-location-update-with-fusedapi-only-if-am-moving