android-location

Location is empty at the start

不问归期 提交于 2021-02-12 11:40:44
问题 I am reframing my last question, which is unanswered, and I have rewritten the problem following Google's BasicLocation. My main activity is defined as: public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { // private LocationCallback locationCallback; // private FusedLocationProviderClient mFusedLocationClient; private FusedLocationProviderClient mFusedLocationClient; protected Location mLastLocation; private static final int REQUEST

How can I cat latitude and longitude of Android device?

五迷三道 提交于 2021-02-11 17:42:28
问题 So I'm making this app which finds restaurants near you, fetching information from a food-delivery app, using JSoup library. The only problem with it is that sometimes the latitude and the longitude are getting null value. Situations in which my application is working: -turning on GPS and the waiting at least 1-2 minutes; -opening google maps, closing it, and then returning to the application; So the main problem: I can't fetch the location right after I enable it and hit the 'Find

How can I cat latitude and longitude of Android device?

若如初见. 提交于 2021-02-11 17:41:40
问题 So I'm making this app which finds restaurants near you, fetching information from a food-delivery app, using JSoup library. The only problem with it is that sometimes the latitude and the longitude are getting null value. Situations in which my application is working: -turning on GPS and the waiting at least 1-2 minutes; -opening google maps, closing it, and then returning to the application; So the main problem: I can't fetch the location right after I enable it and hit the 'Find

How to enable location on Android in program code?

大兔子大兔子 提交于 2021-02-11 06:42:58
问题 I would like to enable the location settings on an android machine. In my program I check if the LocationManager lm = (LocationManager) getSystemService(LOCATION_SERVICE); if (!lm.isProviderEnabled(LocationManager.GPS_PROVIDER)) { ..// } If deactive, I would like to activate it programatically. EDIT: When my location settings are disabled and I call/use googleMaps, I am asked by means of a dialog, whether I want to enable it? If "Yes", the location service is being enabled in the background

Location not getting called from WorkManager

笑着哭i 提交于 2021-01-29 05:39:13
问题 I am using work manager to start location services, it loads doWork() method after every 15 minutes , but does not execute onLocationChanged . Before i was using Job Scheduler, and it was working just fine. The following code also works fine, if i display notification from Work Manager after 15 minutes. This is my code. public class LocationWorker extends Worker implements LocationListener, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener{ private static final

Get timezone directly from Country and State Google API

眉间皱痕 提交于 2021-01-29 05:31:44
问题 I need to get the timezone from just country and state (E.g. Australia/Sydney). There's an answer here that gets the coordinates first then requests for the timezone using the coordinates as params. But I'm asking is there a direct way of doing this via any google API? 回答1: Yes, you can use the Time Zone API, the Google Maps Time Zone API provides a simple interface to request the time zone for a location on the earth, as well as that location's time offset from UTC. The Google Maps Time Zone

Why is mock location jumping back to real position

醉酒当歌 提交于 2020-12-29 19:55:23
问题 I added a test provider using LocationManager.GPS_PROVIDER as provider name like described here https://mobiarch.wordpress.com/2012/07/17/testing-with-mock-location-data-in-android/ In Google Maps app, I see location jumping between mocked location and real location, and then back to mocked location. Why is jumping to real location and how can I stop it? Maybe I misunderstand how to use mock locations. I haven't found any official documentation available. 回答1: You most likely have your

Why is mock location jumping back to real position

女生的网名这么多〃 提交于 2020-12-29 19:47:28
问题 I added a test provider using LocationManager.GPS_PROVIDER as provider name like described here https://mobiarch.wordpress.com/2012/07/17/testing-with-mock-location-data-in-android/ In Google Maps app, I see location jumping between mocked location and real location, and then back to mocked location. Why is jumping to real location and how can I stop it? Maybe I misunderstand how to use mock locations. I haven't found any official documentation available. 回答1: You most likely have your

Do network location provider need internet to determine location?

戏子无情 提交于 2020-12-03 07:42:56
问题 Do Android devices need internet when using network provider for location fetching? I see few articles saying it works without internet and few saying it needs internet. I am looking more into how Android internally does location fetching (rather than the code). Articles saying we need internet: Device captures cell id and wifi hotspots and sends it to google server. And google server returns the location information. These articles are saying we need internet to get location. Few articles

Do network location provider need internet to determine location?

◇◆丶佛笑我妖孽 提交于 2020-12-03 07:41:07
问题 Do Android devices need internet when using network provider for location fetching? I see few articles saying it works without internet and few saying it needs internet. I am looking more into how Android internally does location fetching (rather than the code). Articles saying we need internet: Device captures cell id and wifi hotspots and sends it to google server. And google server returns the location information. These articles are saying we need internet to get location. Few articles