android-location

Geocoder.getFromLocation grpc failed on Android real device

南楼画角 提交于 2019-11-30 03:23:51
问题 I need to get the city and state from latitude and longitude. Geocoder does this function to get the city and state. But I am getting an error java.io.IOException: grpc failed in below line only on Android real device . It is working fine in emulators . new Geocoder(context).getFromLocation(latLng.latitude, latLng.longitude, 1).get(0); Also I have been calling this function using Asynctask which is suggested in another post Geocoder grpc failed in stack overflow but nothing works for me. And

Google Places API Picker display Only Certain Types of Places

跟風遠走 提交于 2019-11-30 00:36:35
问题 I am making certain android app that requires user to choose a place. I am planning to user google places API.Link: https://developers.google.com/places/android/ This API gives gives nice way to do so through through Place Picker. https://developers.google.com/places/android/placepicker Now suppose I want to only show user places of food type (restaurant, hotel etc.) . Using Places Browser API this can be done by adding "type=restraunts" attribute in the requests. Is there a way to show only

Dramatic shift in location accuracy distribution starting February 15

佐手、 提交于 2019-11-29 21:03:52
I am trying to make sense of an inexplicable situation — starting February 15, a remarkably high percentage of the location readings we captured in our app are reporting exactly 10.0m accuracy, which seems strongly correlated with those arriving from a GPS source, as we see it almost exclusively with High-Accuracy and Sensor-Only mode (though there have been occasions where Battery Saving). After reviewing our system, we don't see any point where we could be introducing this ourselves. It affects all deployed versions of our app. We have begun to instrument our application to get more metadata

Minimal android foreground service killed on high-end phone

孤者浪人 提交于 2019-11-29 20:42:43
I'm trying to create an app that lets users log routes (locations/GPS). To ensure locations are logged even when the screen is off, I have created a foreground service for the location logging. I store the locations in a Room Database which is injected into my service using Dagger2 . However, this service is killed by Android which is, of course, not good. I could subscribe to low memory warnings but that doesn't solve the underlying problem of my service getting killed after ~30 minutes on a modern high-end phone running Android 8.0 I have created a minimal project with only a "Hello world"

Can localization resources be downloaded in runtime?

大城市里の小女人 提交于 2019-11-29 19:30:31
问题 I have application with internet access and don't want to store many string.xml files for different languages. What I want: Application contains only one string.xml with english strings. When user launches it - I see user's phone locale, and ask my own server for necessary language file. (resource keys will be the same) When new resource file comes, all interface should work with new file. The question is how to change existing or add new string.xml file in runtime? 回答1: You obviously cannot

Are there any advantages of using FusedLocationProviderApi over LocationManager?

萝らか妹 提交于 2019-11-29 17:03:17
问题 Earlier to get user current location I have used LocationManager: LocationManager locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE); if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); } else if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) { location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); } It

How to get current exact location in android without internet connection?

自古美人都是妖i 提交于 2019-11-29 15:42:57
问题 I want to get current exact location coordinates in android. I am able to get the location if mobile is connected to Wifi internet connection and but in other case when I go some where else and no internet connection available then it not giving the current location coordinates. instead giving last location coordinates. For example: Currently I am in A city and get current coordinates by on the wifi connection and move to City B then I am not able to fetch current coordinates. Instead of this

How to write Espresso Tests which are mocking GPS locations and use them in Google Testlab?

烈酒焚心 提交于 2019-11-29 15:24:15
I recorded an espresso test with Espresso Recorder. I want to test some location changes in my app. Currently I'm mocking the location with this code: LocationManager lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setAccuracy( Criteria.ACCURACY_FINE ); String mocLocationProvider = LocationManager.GPS_PROVIDER;//lm.getBestProvider( criteria, true ); lm.addTestProvider(mocLocationProvider, false, false, false, false, true, true, true, 0, 5); lm.setTestProviderEnabled(mocLocationProvider, true); Location loc = new Location

Get GPS Location instantly via Android app

与世无争的帅哥 提交于 2019-11-29 12:27:31
all. I am writing an android app about GPS locations. I tried it on emulator and entered the latitude and longitude manually, and it worked fine. However, my problem is: on the real device, in debugging mode, to go the next class by using intent can only be achieved when location is changed. If I start the app directly, I can see the blinking GPS icon, but the app will only stay here, and won't start the next activity. It seems that the variables in the onLocationChanged() will never be changed. I have heard that to get the location instantly is to use the getLastKnownLocation() method. But I

Location Client request location updates with parcelable extras in PendingIntent

佐手、 提交于 2019-11-29 11:27:49
I am using LocationClient with PendingIntent to get location updates. PendingIntent.getService(context, 0, new Intent(context, OnLocationAvail.class), PendingIntent.FLAG_UPDATE_CURRENT) The Above code works fine I get the location from the key LocationClient.KEY_LOCATION_CHANGED But when I have an extras of parcelable data as described below, the service gets called with the parcelable data but the key LocationClient.KEY_LOCATION_CHANGED in the intent extras is always null. Intent callbackIntent = new Intent(context, OnLocationAvail.class); callbackIntent.putExtra(SOME_KEY, PARCELABLE_DATA);