geolocation

javascript geolocation on android doesn't work

若如初见. 提交于 2019-12-29 06:16:29
问题 I am developing a website that relies on pulling the geolocation data of a mobile user. I am doing it the typical way via: function initialize() { if(window.google && google.gears) { var geo = google.gears.factory.create('beta.geolocation'); geo.getCurrentPosition(useLocation, errorOnLocate); } else if(navigator.geolocation) { navigator.geolocation.getCurrentPosition(useLocation, errorOnLocate); } else { alert("no geo found"); } } function errorOnLocate(message) { alert(message); zoomTo(-34

Can a broadcastReceiver catch multiple broadcasts?

半腔热情 提交于 2019-12-29 04:23:08
问题 I am trying to create multiple proximity alerts but I cant get it to work... I think that the broadcast receiver gets overwritten and thus is handling only the last broadcast. So if I had two points close by only the one whose intent was created last will generate an alert... I read that I should use request codes but I have no idea on how to do that... My method for setting up the pending intents and the broadcast receiver... private void addProximityAlert(double latitude, double longitude,

Geolocation feedback while accepting the request

邮差的信 提交于 2019-12-29 03:33:13
问题 the geolocation implementation is quite good and got few steps to observe but only on thing is missing, i guess. Im not able to see if the user accepted the request or not ( before i get the position object ), i dunno if the user just ignores my request ( during my timeout ) or if the request just get lost ( and the failure callback doesnt get called for no reason ). It would be useful to set a timestamp when the user accepts the request, i couldnt find anything which gives me that kind of

Google Map click marker by external link

别说谁变了你拦得住时间么 提交于 2019-12-29 02:01:49
问题 Google map, on click external link target marker. Find fiddle demo below. find fiddle demo google.maps.event.addListener(marker, 'click', (function(marker, i) { return function() { infowindow.setContent(locations[i][0]); infowindow.open(map, marker); map.setZoom(9); map.setCenter(marker.getPosition()); } })(marker, i)); function triggerClick(i) { google.maps.event.trigger(markers[i],'click'); } <ul class="nav"> <li><a href="javascript:triggerClick(0)">location1</a></li> <li><a href=

HTML5 navigator.geolocation in Web Workers

怎甘沉沦 提交于 2019-12-29 01:35:14
问题 I am trying to move my code for navigator.geolocation in a web worker. I tried it with Chrome and Safari but getting 'undefined' on var isGPSSupported = navigator.geolocation; Frustrated... they said in specification that 'navigator' object should be supported in web workers... My code is below: index.js var gpsWorker = new Worker("app/gpsworker.js"); gpsWorker.onmessage = function (e) { alert(e.data); }; gpsWorker.postMessage("Start GPS!"); gpsWorker.onerror = function (e) { alert("Error in

How to Search in Google Map Api V2 Android?

只谈情不闲聊 提交于 2019-12-28 13:35:12
问题 I'm developing an Android application and using GoogleMaps API v2. This application works so far but I want search in the map with a path: Screenshot : my codes: Position_mark = new LatLng(35.7008, 51.437); map.moveCamera(CameraUpdateFactory.newLatLngZoom(Position_mark, 15)); map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null); map.setOnMapClickListener(this); map.setOnMapLongClickListener(this); map.setOnMarkerDragListener(this); ... @Override public boolean onCreateOptionsMenu

Android GPS Coordinates Scattered

末鹿安然 提交于 2019-12-28 12:44:23
问题 I have the following code below which seems to be working fine: // GPS Reader // Criteria Criteria criteria = new Criteria(); //criteria.setAccuracy(Criteria.ACCURACY_COARSE); // Used when we can't get a GPS Fix criteria.setAccuracy(Criteria.ACCURACY_FINE); // Used when we can get a GPS Fix criteria.setAltitudeRequired(false); criteria.setBearingRequired(false); criteria.setCostAllowed(true); criteria.setPowerRequirement(Criteria.POWER_LOW); LocationListener locationListener = new

Android GPS Coordinates Scattered

不打扰是莪最后的温柔 提交于 2019-12-28 12:44:07
问题 I have the following code below which seems to be working fine: // GPS Reader // Criteria Criteria criteria = new Criteria(); //criteria.setAccuracy(Criteria.ACCURACY_COARSE); // Used when we can't get a GPS Fix criteria.setAccuracy(Criteria.ACCURACY_FINE); // Used when we can get a GPS Fix criteria.setAltitudeRequired(false); criteria.setBearingRequired(false); criteria.setCostAllowed(true); criteria.setPowerRequirement(Criteria.POWER_LOW); LocationListener locationListener = new

Get country from coordinates?

为君一笑 提交于 2019-12-28 09:20:11
问题 How to get country name in Android, If are known geo coordinates? How to make it the simplest way? 回答1: Use Below Function for that. public void getAddress(double lat, double lng) { Geocoder geocoder = new Geocoder(HomeActivity.mContext, Locale.getDefault()); try { List<Address> addresses = geocoder.getFromLocation(lat, lng, 1); Address obj = addresses.get(0); String add = obj.getAddressLine(0); GUIStatics.currentAddress = obj.getSubAdminArea() + "," + obj.getAdminArea(); GUIStatics.latitude

ask for geolocation permission again if it was denied

喜夏-厌秋 提交于 2019-12-28 05:56:09
问题 im building an app through phonegap, with a geolocation button. if a user denies permission for geolocation the first time, how can i ask for permission again when they click the geolocation button again? my code structure at the moment is: function getLocation() { if(navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition, positionError); } else { hideLoadingDiv() showError('Geolocation is not supported by this device') } } function positionError() { hideLoadingDiv()