Questions tagged [locationmanager]

The LocationManager class in Android provides access to the system location services. These services allow applications to obtain periodic updates of the device's geographical location, or to fire an application-specified Intent when the device enters the proximity of a given geographical location.

The LocationManager class in Android SDK provides access to the system location services. These services allow applications to obtain periodic updates of the device's geographical location, or to fire an application-specified Intent when the device enters the proximity of a given geographical location.

1056 questions
-1
votes
3 answers

android - piece of code used to find current location not working

I am using the following piece of code in my Android application to find my mobile device's current location : LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); Location location =…
Marievi
  • 4,951
  • 1
  • 16
  • 33
-1
votes
1 answer

Why getLastLocation() method not retrieving the location the very first time app is launched?

I'm developing an android app and I want to retrieve user's current location as soon as the app is launched. I'm using this code: @Override public void onConnected(@Nullable Bundle bundle) { if (ActivityCompat.checkSelfPermission(this,…
-1
votes
2 answers

Please Help me for gtting the current location of the Android phone

Please Help me for creating an application for getting the current location of the android phone. Thank you.
mohammedsuhail
  • 701
  • 2
  • 11
  • 23
-1
votes
1 answer

How to get list of apps that use location programmatically in Android?

I'm developing an app on Android OS. I need a method that returns the list of apps that rely on location services/GPS
Mrunal
  • 195
  • 1
  • 1
  • 10
-1
votes
2 answers

How to stop GPS BroadcastReceiver

I use broadcastreceiver on my gps that check if an user disabled GPS while app working. If the user disabled, then shows a dialog with information that a GPS is requaired. This is my sample in manifest:
SeaDog
  • 645
  • 1
  • 9
  • 32
-1
votes
2 answers

What is the name of the parameter before the method in Swift?

optional func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) What is didUpdateLocations? What is the reason for using such a name? I think generally, with other methods.
martinek
  • 78
  • 5
-1
votes
1 answer

My LocationManager settings are changing back to default when it reaches didUpdateLocations

So, first stack overflow question but a long time reader ;) My LocationManager settings are changing back to default when it reaches didUpdateLocations. I've set up an observer in viewDidLoad as well as some defaults like so. I'm also alloc…
-1
votes
2 answers

Android NullPointerException when getting LocationManager from service context

I'm getting: Caused by: java.lang.NullPointerException at android.content.ContextWrapper.getSystemService(ContextWrapper.java:423) when the app: locationManager = (LocationManager)…
fadedbee
  • 42,671
  • 44
  • 178
  • 308
-1
votes
1 answer

Android: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()

I am making an android app where I am trying to get location using location manager and then I push that location to a server. When I try to do this I am getting the following error. java.lang.RuntimeException: Can't create handler inside thread…
varunkr
  • 5,364
  • 11
  • 50
  • 99
-1
votes
1 answer

does calling locationmanager.removeupdates permanently removes it in android?

I'm creating an App to send Latitude and Longitude via SMS if the mobile moves in one minute interval. I used an ArrayList to save six LatLngs after ArrayList reaches six elements it sends SMS. If the device stops moving within the time of six…
Praveen Kumar
  • 547
  • 1
  • 7
  • 33
-1
votes
1 answer

How to request a start for startUpdatingLocation?

I'm starting a location manager as i open the view with this code: func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) { var userLocation: CLLocation = locations[0] as! CLLocation userLatitude =…
-1
votes
4 answers

Getting current location in Android

I know it is a common question and has been answered a number of times... But I am looking for an answer to a specific problem. I have written a method which is required to return current lat/long as string. The code goes like this: public class…
anant sophia
  • 55
  • 2
  • 12
-1
votes
3 answers

CLLocationManager - Change user's current location forcefully in device

This is not fully functional app but its demo/prototype. Demo is kind of famous places near by you and some photos around. For demo purpose, we have choose NewYork as city. I want to simulate user's device location to New york (blue circle) instead…
harshit2811
  • 827
  • 1
  • 7
  • 21
-1
votes
1 answer

Detect Android User Location

I'm trying to find a solution to detect my android app user location without using the GPS. I'm getting the user location in two different ways, the first one is using the android LocationManager for some devices such as Samsung S2 and Samsung Note…
-1
votes
1 answer

Doesn't show actually position in locationManager in android

I creating an app to GPS tracking. Unfortunetlly the app doesn't show actual location (lat,long). It always shows lat:50.059644 long:19.9206669. But I want to get and show the actual location of user(me). It's my main activity: Button…
Koin Arab
  • 1,045
  • 3
  • 19
  • 35