android-location

MY_PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION permission android not recognised in code

谁说胖子不能爱 提交于 2019-11-28 06:38:06
问题 We are currently trying to request GPS permissions from an android phone so that we can show the current location on a Google Map. We have included this manifest, outside of application tags, under the manifest tag: <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> Here is the part of our code that is not working, it is not recognising MY_PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION: if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE

LocationClient doesn't give callback when screen light goes off but my WakefulThread is running flawlessly as expected

别说谁变了你拦得住时间么 提交于 2019-11-28 05:35:18
To retrieve fused location in background, I have created a library which is very similar to cwac-locpoll library created by Commonsguy. Inside PollerThread , I am trying to connect, request and retrieve the locations using LocationClient . I am able to get connected by receiving callback on onConnected method but I am not able to get callback on onLocationChanged method.so my onTimeout thread executes as per decided interval. NOTE: This issue happens only when screen light goes off.otherwise it works completely fine. I suspect there might be bug in new Location Api. Here is the implementation

Android mock gps provider

非 Y 不嫁゛ 提交于 2019-11-28 04:33:09
问题 My code snippet is: mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); if(mLocationManager.getProvider(LocationManager.GPS_PROVIDER) != null) { mLocationManager.removeTestProvider(LocationManager.GPS_PROVIDER); } mLocationManager.addTestProvider(LocationManager.GPS_PROVIDER, "requiresNetwork" == "", "requiresSatellite" == "", "requiresCell" == "", "hasMonetaryCost" == "", "supportsAltitude" == "", "supportsSpeed" == "", "supportsBearing" == "", android.location

Android - How to get estimated drive time from one place to another?

不羁的心 提交于 2019-11-28 04:25:47
I need to find the estimate drive time from one place to another. I've got latitudes and longitudes for both places but I have no idea how to do that. Is there is any API for that. help thanks. yes you get the time and distance value as well as many like direction details in driving, walking etc mode. all you got from the google direction api service check our this links http://code.google.com/apis/maps/documentation/directions/ Yaqub Ahmad Location location1 = new Location(""); location1.setLatitude(lat); location1.setLongitude(long); Location location2 = new Location(""); location2

Determining the speed of a vehicle using GPS in android

谁说我不能喝 提交于 2019-11-28 02:58:04
I would like to know how to get the speed of a vehicle using your phone while seated in the vehicle using gps. I have read that the accelerometer is not very accurate. Another thing is; will GPS be accessible while seated in a vehicle. Won't it have the same effect as while you are in a building? Here is some code I have tried but I have used the NETWORK PROVIDER instead.I will appreciate the help. Thanks... package com.example.speedtest; import android.app.Activity; import android.content.Context; import android.location.Location; import android.location.LocationListener; import android

Does PRIORITY_BALANCED_POWER_ACCURACY exclude the GPS provider?

放肆的年华 提交于 2019-11-28 02:05:42
问题 Got this from How much accuracy does PRIORITY_BALANCED_POWER_ACCURACY give? The HIGH_ACCURACY mode use all location providers, However, it prioritize the location providers and include GPS along with location providers. The location accuracy is approximately within 10 meters of range. The BALANCED_POWER mode exclude GPS for its list of location providers, and use the other providers based including cell towers, wifi etc. In this case, the location accuracy is approximately 40 meters. The NO

isProviderEnabled(LocationManager.NETWORK_PROVIDER) return false

二次信任 提交于 2019-11-28 01:49:47
I am using NETWORK_PROVIDER to get latitude and longitude of the place. I'v already check the setting in the "location & security" and enable "use wireless networks". But "isProviderEnabled(LocationManager.NETWORK_PROVIDER)" always return false . Can anyone help me? Thank you in advance! Here is my code : LocationManager locManager=(LocationManager) getSystemService(Context.LOCATION_SERVICE); boolean isEnableGPS=locManager.isProviderEnabled(LocationManager.GPS_PROVIDER); boolean isEnableNTW=locManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); Log.d(TAG, isEnableGPS+", "+isEnableNTW)

Get GPS Status on location changed

坚强是说给别人听的谎言 提交于 2019-11-28 01:36:10
I am using GPS services to derive latitude & longitude in my App. I am able to get the latitude and longitude when the signal is avialable. Once i get a fix, if i have to go to a place where the GPS is not able to get a location fix, it still shows the last location. I want to get the current location and not otherwise. I have tried using onLocationChanged() and onGpsStatusChanged() both to get the GPS status but it isnt giving me the result. @Override public void onGpsStatusChanged(int arg0) { // TODO Auto-generated method stub if (event == GpsStatus.GPS_EVENT_STARTED) { Log.d("zmenaGPS" ,

LocationManager's getBestProvider returning null

折月煮酒 提交于 2019-11-27 22:45:55
I have a bunch of people reporting an error that I cannot reproduce. When trying to open a MapView it's reporting that the getBestProvider is returning null and I know that means that that no provider is found that fulfills my criteria which is ACCURACY_COARSE so if there is no GPS then it should fall back on either network or passive but it obviously doesn't on those user devices. What would that even mean then that GPS is off and there is no network connection? I tried turning GPS off and putting the phone into airplane mode to try to reproduce the problem but still I was able to open the

Ask user to turn on Location

风格不统一 提交于 2019-11-27 18:24:15
问题 How can I prompt the user to turn on Location ? The app is supposed to filter a list of locations with the current location of the user. If the user has the Location service turned off, the app should prompt the user asking for the Location to be turned on. For instance Trip Advisor app does this: ( Not sure if I can post other apps screenshots here, but if I shouldn't be doing it, please say so. And apologize for the full sized images, tried to make them smaller, but SO didn't liked it... )