geolocation

Good practices for services on Android

此生再无相见时 提交于 2019-12-02 05:26:27
问题 I am currently using 2 services in my app: 1: LocationService , basically trying to localize the user, and aims to stay alive only when the app is on foreground. 2: XmppService , which init the connection with the xmpp server, receive messages, send it, logout ... and aims to stay alive until the user logout. I've been reading quite a lot of documentation, but I just can't make it clear. I'm having Leaks when I try to store reference of LocationServiceBinder, which is used to call my service

Can't turn on location on android api23?

五迷三道 提交于 2019-12-02 04:19:38
I have used the following code and the dialogue that asks for permission shows as expected. But when I click "allow" it doesn't do anything. The log message doesn't appear as if the permission wasn't granted so I went to my parameters to verify if location is "on" and it was "off". Wasn't it supposed to be on because I granted the app access to my location ? If I manually turn it "on" and then run the app again, once it asks for my permission, it works and shows the log message but isn't the whole point of asking for permissions (via dialogue) to turn on location (when it's off) if the user

I want to get location in a variable and want to use this variable to apply conditions

最后都变了- 提交于 2019-12-02 04:17:14
I have two pages. One is login page and in other page i am finding my location using Geolocation. But in login page I want to get that variable from location file and apply conditions on that variable..... <script> function displayLocation(latitude,longitude){ var request = new XMLHttpRequest(); var method = 'GET'; var url = 'http://maps.googleapis.com/maps/api/geocode/json? latlng='+latitude+','+longitude+'&sensor=true'; var async = true; request.open(method, url, async); request.onreadystatechange = function(){ if(request.readyState == 4 && request.status == 200){ var data = JSON.parse

Good practices for services on Android

房东的猫 提交于 2019-12-02 02:17:45
I am currently using 2 services in my app: 1: LocationService , basically trying to localize the user, and aims to stay alive only when the app is on foreground. 2: XmppService , which init the connection with the xmpp server, receive messages, send it, logout ... and aims to stay alive until the user logout. I've been reading quite a lot of documentation, but I just can't make it clear. I'm having Leaks when I try to store reference of LocationServiceBinder, which is used to call my service functions ( using AIDL interfaces ). Same for Xmpp. When I unbind, I get sometimes ANR ( which look

Get twelve digits after decimal for latitude and longitude

£可爱£侵袭症+ 提交于 2019-12-02 01:45:50
问题 I have an application in which I have to get user's current location from latitude and longitude. For both the values, I have to get 12 digits after decimal. This is the gps tracker class for getting the user location: public class GPSTracker extends Service implements LocationListener { private final Context mContext; // flag for GPS status boolean isGPSEnabled = false; // flag for network status boolean isNetworkEnabled = false; // flag for GPS status boolean canGetLocation = false;

GoogleMap Markers are Not Clickable on the Mobile Devices

丶灬走出姿态 提交于 2019-12-02 01:42:13
GoogleMap Markers are Not Clickable on the Mobile Devices (Touch Screens). But, ok on any PC, so I can't figure out what is the point. Here is my code: var map = new google.maps.Map(document.getElementById('map'), { zoom: 10, center: new google.maps.LatLng(60.037760, -44.100494), mapTypeId: google.maps.MapTypeId.ROADMAP }); var locations = [ ['4lvin', 60.074433, -44.011917], ['5irius', 60.037760, -44.100494] ]; for (var i = 0; i < locations.length; i++) { var marker = new google.maps.Marker({ position: new google.maps.LatLng(locations[i][1], locations[i][2]), map: map }); var infowindow = new

Get physical position of device with Python?

。_饼干妹妹 提交于 2019-12-02 01:40:04
问题 Is there a way to get the computer's physical position using Python, preferably without an API, or with a free API? I've searched around a bit, and the only free API I've found is very, very inaccurate. I only need this to be somewhat accurate, as it's for getting local weather. 回答1: You can scrape it from a webpage like http://www.geoiptool.com/ for example. 回答2: You can try using MaxMind's GeoIP Python API with their free GeoLite City database. Accuracy may vary, more details here. Also

Get twelve digits after decimal for latitude and longitude

旧巷老猫 提交于 2019-12-02 01:39:11
I have an application in which I have to get user's current location from latitude and longitude. For both the values, I have to get 12 digits after decimal. This is the gps tracker class for getting the user location: public class GPSTracker extends Service implements LocationListener { private final Context mContext; // flag for GPS status boolean isGPSEnabled = false; // flag for network status boolean isNetworkEnabled = false; // flag for GPS status boolean canGetLocation = false; Location location; // location double latitude; // latitude double longitude; // longitude private String

navigator.geolocation.getCurrentPosition() when screen is locked

坚强是说给别人听的谎言 提交于 2019-12-02 00:15:51
I have an App which constantly polls for location when its in travelling mode. My issue is that once the screen is locked, the App can no longer access the geolocation from the phone. I have managed to find this plugin but it requires I purchase it for the capability to work in Android. http://shop.transistorsoft.com/pages/cordova-background-geolocation-premium Does anyone know if there is a free option that i can use to get location to successfully poll in an Ionic / Cordova application while the screen is locked? DaveAlden Another option is to use a partial wakelock on Android to keep your

Get physical position of device with Python?

醉酒当歌 提交于 2019-12-02 00:14:00
Is there a way to get the computer's physical position using Python, preferably without an API, or with a free API? I've searched around a bit, and the only free API I've found is very, very inaccurate. I only need this to be somewhat accurate, as it's for getting local weather. You can scrape it from a webpage like http://www.geoiptool.com/ for example. Paulo Freitas You can try using MaxMind's GeoIP Python API with their free GeoLite City database . Accuracy may vary, more details here . Also take a look at this question for other alternatives. import urllib2 import json # Automatically