locationmanager

Android LocationManager Criteria

不想你离开。 提交于 2019-12-09 03:10:32
问题 I need to receive location changes both from Network and GPS providers. If GPS provider not avaliable or has not location (bad sattelite visibility) I would receive location from Network provider else from GPS provider. Is it possible to select provider using criteria according to my necessity? 回答1: Actually Android Developers - Making Your App Location Aware has a great example code to meet your needs. in its code, if you use both providers (from GPS and from Network) it will do a comparison

Android: I want to obtain location using GPS in the background for use with a directions tool in my app, how?

房东的猫 提交于 2019-12-08 13:42:30
问题 One of the activities for my company's app has a directions utility that allows the user to input their postcode, choose one of our offices, and Maps will route from the given postcode to one of our offices. Leaving the postcode field blank results in Maps defaulting to 'your location', however you need to click 'Go' in the Maps app for it to work, while providing a postcode will automatically do the routing without having to make that extra click. This is a small but necessary thing that

IntentService, PendingIntent, and AlarmManager: Cannot keep process running indefinitely?

我的未来我决定 提交于 2019-12-08 12:08:22
问题 I've got a pretty simple app that runs two services in the background, using IntentService with AlarmManager. One is a "messaging" service that sends a JSON request and parses the response, the other polls for location from a LocationManager. The requirement here is that they run on an interval, indefinitely, until manually stopped by the user, with a button - even if the device's screen hasn't been turned on for days. The services must never stop. Battery life is not a concern. My minimum

Can't get current location android on location changed

耗尽温柔 提交于 2019-12-08 11:19:14
问题 whats wrong with my PC i am using and android studio (macbook). i had tried different ways to get current location but every time i failed i followed different tutorials using different procedure to get location but had no luck. i followed this tutorial but it doesn't worked for me but i downloaded the source code it worked fine, if i create new project and try to add files from sample project it doesn't work. i also tried this and this but no luck. is there some thing wrong with my android

Android - Location by LocationManager different from GoogleMaps

风格不统一 提交于 2019-12-08 00:25:46
问题 I have created a location listener by 'LocationManager' with this code: mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 100, 100, mListenerNetwork); and the listener: LocationListener mListenerNetwork = new LocationListener() { public void onLocationChanged(Location location) { // New Location by LocationManager } public void onProviderDisabled(String provider) { } public void onProviderEnabled(String provider) { } public void onStatusChanged(String provider, int

Notify users when they reach a location

最后都变了- 提交于 2019-12-07 16:33:25
问题 In the application I'm working on, one of the features is to notify the user when they reach a location that they have set prior. The code below is in addProximityAlert in Activity: final Intent intent = new Intent(PROX_ALERT_INTENT); final PendingIntent pendingIntent = PendingIntent.getBroadcast( InfoActivity.this, 0, intent, PendingIntent.FLAG_ONE_SHOT); LocationManager locationManager = (LocationManager) this .getSystemService(Context.LOCATION_SERVICE); locationManager.addProximityAlert(18

getting current location longitude and latitude in android

安稳与你 提交于 2019-12-06 12:52:38
问题 THis is my location class with this i am getting location longitude and latitude, but my problem is if i change my current location the longitude and latitude values are not updating. if i store my home location in my device, then my app is taking every time the same longitude and latitude values it is not taking my current location details. ex: I was in new york today and I launched a app and the location was my home in new jersey. public class GetLocation extends Activity { protected

Android Location not returning Location from Custom Class

岁酱吖の 提交于 2019-12-06 12:38:49
问题 I have my own location class. I have an odds result that when I search for the GPS location using my class, I get 0, 0 back. Whereas if I search the getLastKnown function in location manager for GPS, I get the forced value: public Location getGPSloc(Context c){ isGPSavailable(c); if(gps_enabled) lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 0, locationListenerGps); timerGPS = new Timer(); timerGPS.schedule(new GetLastLocationGPS(), 45000); return gpsLoc; } This is the class

Android: GPS location updates when the cellphone is in sleep?

試著忘記壹切 提交于 2019-12-06 10:21:49
问题 I need to update the location through GPS in the background even when the phone is in sleep. I am thinking to use AlarmManager to broadcast an Intent and then a receiver will call requestLocationUpdates() on LocationManager. But I am not sure whether it's guaranteed that the GPS location will be updated when the phone is in sleep and an intent will be broadcasted if I registered a PendingIntent when call requestLocationUpdates()? thanks, 回答1: GPS aren't working when screen is off! You may set

different behaviour for current location latitude and longitude in iOS7 to IOS8

落爺英雄遲暮 提交于 2019-12-06 10:10:09
Using xamarin for current location currentLocation example I used the above Link for getting current location latitude and longitude. In IOS 7 before upgrade to IOS 8 Its shows my current location latitude and longitude on both simulator and device.(Its looks strange for me in simulator for getting current location latitude and longitude). After upgrade to iOS 8 and run same code it give In simulator:(Turn on wifi no sim card location service App always.) Result: latitude = 37.785834. longitude = -122.406517. On Device IPhone5c (Turn on wifi no sim card location service App always.) Result: