gps

Android Listen For Change in GPS Status?

和自甴很熟 提交于 2019-12-01 01:44:06
Hello I need to know how to listen for the following with the GPS in Android so I can update the UI in a PreferenceActivity . I have tried GpsStatus.Listener with nothing happening. GpsStatus.GPS_EVENT_STARTED GpsStatus.GPS_EVENT_STOPPED Any suggestions would be great. mLocationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); // Define a listener that responds to location updates mGPSStatusListener = new GpsStatus.Listener() { public void onGpsStatusChanged(int event) { switch (event) { case GpsStatus.GPS_EVENT_SATELLITE_STATUS: satelliteStatus = mLocationManager

Android Turn-by-Turn API?

◇◆丶佛笑我妖孽 提交于 2019-12-01 01:40:13
问题 Android 2.0 has turn-by-turn directions, however, I do not yet see an API exposed for this in the 2.0 SDK. Are there any documented plans to expose an API for calling into the new turn-by-turn features? 回答1: I will be rather surprised if there is an API for this. Bear in mind that Google licenses much of this data from TeleAtlas. It is one thing for Google to license it for its own use, and that probably was not cheap. It is quite another thing for Google to license it on behalf of arbitrary

Detect GPS Hardware in iphone

江枫思渺然 提交于 2019-12-01 01:29:00
I want to know how to detect GPS HardWare in present in Iphone or not Even though you can not determine this using the SDK, you may exploit your knowledge of current models. If you limit yourself to iPhone 3G, iPhone 3GS and iPod Touch 2nd generation (I do not personally support older iPhone edge or iPod Touch 1st generation), then you already know that the iPhone models ship with a real AGPS unit while the iPod Touch 2nd generation can use - if and when available - geotagged wifi hot spots. You may then use the following method to determine the model you are running on: - (NSString *)

how to enable gps in android

限于喜欢 提交于 2019-12-01 01:17:43
how to open the gps in android when it is closed to retrieve the current position I test two method private void turnGPSOn(){ String provider = Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); if(!provider.contains("gps")){ //if gps is disabled final Intent poke = new Intent(); poke.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider"); poke.addCategory(Intent.CATEGORY_ALTERNATIVE); poke.setData(Uri.parse("3")); sendBroadcast(poke); } } private void turnGPSOff(){ String provider = Settings.Secure.getString

How to draw at the current GPS location on MapView using MyLocationOverlay?

て烟熏妆下的殇ゞ 提交于 2019-12-01 01:09:19
I'm trying to draw a custom gps-location icon. I'm using MapView and have created a class MyLocationArrow that extends MyLocationOverlay . I override drawMyLocation() and draw a point at 100,100. But this is the coordinates on screen. How do I get the screen-coordinates from the current GPS-location? NickT You can use android.graphics.Point toPixels(GeoPoint in, android.graphics.Point out) Converts the given GeoPoint to onscreen pixel coordinates, relative to the top-left of the MapView that provided this Projection . . 来源: https://stackoverflow.com/questions/4624993/how-to-draw-at-the-current

Getting the Position of an Android phone by using GPS

∥☆過路亽.° 提交于 2019-12-01 01:00:25
I've got another question regarding to basic Android programming: How can I access the GPS for getting the current Position of the mobile phone the app is running on? How long can this take to retrieve the information? In this case the GPS might be disabled, how can I enable/disable it again. Which permissions must be granted in the andorid manifest? Greetings and thanks for ur answers, poeschlorn Some answers: Access: see LocationManager and LocationListener . Permissions: android.permission.ACCESS_FINE_LOCATION Demo: public class GPSLocationManager implements LocationObservable { private

How determine if point is within rectangle given all latitude/longitude coordinates?

倖福魔咒の 提交于 2019-12-01 00:51:03
If given x/y coordinates for all 4 corners of rectangle, and then another x/y, it's easy to determine if the point is within the rectangle if top left is 0,0. But what if the coordinates are latitude/longitude where they can be negative (please see attached). Is there a formula that can work in this case? Mathematicaly, you could use inequations to determine that. edit: When doing the example, i've noticed you put the coordinates in the inverse format (y,x) instead of (x,y). In my example I use (x,y) format, so I just inverted the order to easy my explanation. Let's say A = (-130,10) B = (-100

Android: GPS fallback from fine to coarse

China☆狼群 提交于 2019-12-01 00:01:09
Greetings, Does anyone know how I can get coarse GPS coordinates when I don't have a fix and get fine GPS coordinates when I have a fix? I've tried googling for some sample code to no avail. I did find this: http://www.android10.org/index.php/articleslocationmaps/226-android-location-providers-gps-network-passive But I don't know how to implement the fallback to coarse/upgrade to fine. I hope someone can help. Thanks in advance, You can find an excellent introduction to the subject in the documentation . The basic idea is that you enable listening for updates from different providers. When a

Mock GPS location issue

微笑、不失礼 提交于 2019-11-30 23:57:36
I'm developing an APP that get user specified latitude,longitude, and altitude, then fake this GPS location on the phone, and show that I am at that location in google map. I have the required permission on manifest file and mocked location is enabled in developer settings. LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); //lm.clearTestProviderEnabled(mocLocationProvider); lm.addTestProvider(mocLocationProvider, false, false, false, false, false, false, false, 0, 10); lm.setTestProviderEnabled(mocLocationProvider, true); mockLocation = new Location

How can I monitor the status of the GPS adapter using Android SDK?

安稳与你 提交于 2019-11-30 23:07:50
I need to have my app monitor whether the GPS adapter is anabled or disabled. I don't care about the actual GPS functionality running at the monemt or not -- I need the status of the GPS adapter. I can manually do it by calling: String providers = Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); If "gps" is listed, then it's active, otherwise it's not. But I can't find any documentation on getting notified when GPS is enabled or disabled by the user. I did try to use addGpsStatusListener in LocationManager, but that only notifies when the actual GPS