geolocation

How to know if BlackBerry device has GPS?

拥有回忆 提交于 2019-12-01 23:37:17
问题 I want to know if the device has GPS or not, how could I do that for the devices below v 5.0 ? 回答1: Have a look at docs for Location Provider. Try this code on a few devices in different situations and I think it should work: try { LocationProvider lp = LocationProvider.getInstance(null); if (lp == null) { //Device doesn't currently have GPS enabled } else { //Device has GPS enabled } } catch (LocationException le) { //Device's GPS is currently permanently disabled } 回答2: You have to check if

Request location coordinates after user has blocked access in javascript

大憨熊 提交于 2019-12-01 23:34:19
问题 How can I prompt a user for their geo-location in javascript if they've blocked my request in the past? (using navigator.geolocation.getCurrentPosition). For example, my web app requires location services, and the user accidentally clicks "block", or they change their mind. What can I do to prompt them again? 回答1: As mentioned by @matthew-shwery, you can not change the permission. the best you could do is check for the permission and notify the user is the permission is denied navigator

How to know if BlackBerry device has GPS?

余生长醉 提交于 2019-12-01 22:08:13
I want to know if the device has GPS or not, how could I do that for the devices below v 5.0 ? Have a look at docs for Location Provider . Try this code on a few devices in different situations and I think it should work: try { LocationProvider lp = LocationProvider.getInstance(null); if (lp == null) { //Device doesn't currently have GPS enabled } else { //Device has GPS enabled } } catch (LocationException le) { //Device's GPS is currently permanently disabled } You have to check if Java ME's JSR 179 is available . 来源: https://stackoverflow.com/questions/4400976/how-to-know-if-blackberry

Global location input autocomplete

99封情书 提交于 2019-12-01 22:05:09
I was looking for a plugin to create a smart location form field which has a suggested autocomplete. I was unable to find anything suitable (Google Geocode is too unreliable on its own, and it isn't designed for this) so I built my own. I thought it was crazy that in 2011 an open-source global location input plugin like this didn't exist so set out to give it a go. The demo is here http://labs.unxposed.net/unxposed/geocode/ and is working on Chrome and Firefox 4. Download is here https://github.com/unxposed/geocode There is one major issue I am having with it. Sometimes it works great like so.

Finding current location works when using Wifi, but fails when using GPS

血红的双手。 提交于 2019-12-01 20:10:28
问题 I have developed an application to find the user's location using GPS. In this there is no error. It finds the location using Wifi correctly, but in GPS mode it doesn't return any values. I added the needed permission in the manifest and GPS is on. Can someone please tell me how to get the location using Gps? I have included my code here: package c.g.a.loation; public class UseGps extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState)

Polygon area calculation using Latitude and Longitude

喜你入骨 提交于 2019-12-01 19:44:28
I am using a solution I've found in this post: Polygon area calculation using Latitude and Longitude generated from Cartesian space and a world file There is something wrong because the values I am getting are not real. For example we know a football field should have around 5,300.00 square meters, right? but the calculation is giving 5,759,154.21. This is the code: private static double CalculatePolygonArea(IList<Position> coordinates) { double area = 0; if (coordinates.Count > 2) { for (var i = 0; i < coordinates.Count - 1; i++) { Position p1 = coordinates[i]; Position p2 = coordinates[i + 1

Requesting single location update, AVD crashes

杀马特。学长 韩版系。学妹 提交于 2019-12-01 19:29:29
I'm trying to request a single location update using the new LocationManager.requestSingleUpdate() method, but once the device gets an update from the GPS the OS crashes and seems to try to reboot. At least I get the usual Android boot screen, but it never finishes booting. I've tried running the code on a 2.3, 2.3.1, 2.3.3 and 2.2 AVD, with the same result on all. ***** Update ***** I tried an old location based app that I have made, and that is running just fine on a few hundred units, and this also crashes the AVD when sending it a location update. I guess this is turning out be more a case

Polygon area calculation using Latitude and Longitude

谁说我不能喝 提交于 2019-12-01 19:03:15
问题 I am using a solution I've found in this post: Polygon area calculation using Latitude and Longitude generated from Cartesian space and a world file There is something wrong because the values I am getting are not real. For example we know a football field should have around 5,300.00 square meters, right? but the calculation is giving 5,759,154.21. This is the code: private static double CalculatePolygonArea(IList<Position> coordinates) { double area = 0; if (coordinates.Count > 2) { for (var

Finding current location works when using Wifi, but fails when using GPS

淺唱寂寞╮ 提交于 2019-12-01 18:45:57
I have developed an application to find the user's location using GPS. In this there is no error. It finds the location using Wifi correctly, but in GPS mode it doesn't return any values. I added the needed permission in the manifest and GPS is on. Can someone please tell me how to get the location using Gps? I have included my code here: package c.g.a.loation; public class UseGps extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LocationManager mlocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

Geolocation not working on Safari 5.x on Windows 7/XP

我只是一个虾纸丫 提交于 2019-12-01 18:11:34
I am working on an app that uses the W3C standard geolocation API but I cannot for the life of me get it to work on Safari on my Windows 7 and XP PC. It works fine on my iPad and my iPhone. It also works perfect on Chrome (5, 6, 7 and the Canary build) and on Firefox (3.6). I don't have a Mac so I can't test it on that. IE doesn't support geolocation yet so that's covered too. I created a stripped down version and I am hosting it on the Google Apps Engine so you can have a look at the code: http://html5-geolocator.appspot.com/ . All the (simplified) javascript is in the html so you should be