locationmanager

android: how to fix gps with mock(fake) coordinates?

送分小仙女□ 提交于 2019-11-30 11:10:45
问题 I'm trying to fix GPS programmatically when the GPS signal is not available. I want to do this in order to provide mock coordinates to other apps like google maps and others. I tried to use GPS_PROVIDER and NETWORK_PROVIDER but only with the latter I can get a new location valid for google maps. But this works only the first tima and if I want to re-fix more mock locations google maps doesn't see any change... why?? I have to do a service for what I want to do? public void setLocation(double

How does getAltitude() of Android GPS Location Works

旧城冷巷雨未停 提交于 2019-11-30 09:25:25
HI I tried to implement a simple GPS tracker. Therefore is used lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, this); Then i used the public void onLocationChanged(Location location) { method to read the altitude of my current location. But i dont really know what Location.getAltitude() returns. The document says it returns the altitude. But is this in meters? or feets? if i put the phone on the desk next to me, this value changes between 500 and -500?? How does this really work??? The altitude value you get

Get current location name of user without using gps or internet but by using Network_Provider in android

女生的网名这么多〃 提交于 2019-11-30 08:39:48
This question is directly related to the same prevailing stackoverflow question at " Android: get current location of user without using gps or internet " where the accepted answer is actually not answering the question. I should be able to get the current location name (eg:city name, village name) of the device via network provider not with GPS or internet. Following is the accepted answer in that question. (The following code parts should be included in the onCreate() method) // Acquire a reference to the system Location Manager LocationManager locationManager = (LocationManager) this

How to get the current location of iPhone through code?

只谈情不闲聊 提交于 2019-11-30 07:41:45
How do you get the current location of iPhone through code? I need to track the location using GPS. You're looking for the "CoreLocation" API. Here's a tutorial Roger There is (as always for core functionality) comprehensive documentation on the developer site and you may find this example useful; The key points to remember are; 1) Once you start receiving location updates, they arrive asynchronously and you need to respond to them as and when they come in. Check the accuracy and timestamps to decide if you want to use the location or not. 2) Don't forget to stop receiving updates as soon as

java.lang.SecurityException: invalid package name: com.google.android.gms

末鹿安然 提交于 2019-11-30 02:51:57
问题 I've got this weird stack trace while testing the app on Samsung Galaxy S2 (GT-i9100), Android version 4.3. If it helps, Bugsense reports also "log data" = {u'ms_from_start': u'19915', u'rooted': u'true'} , so I'm not quite sure if this device is rooted or not (client is testing the app, not me). EDIT: While I'm typing this, client confirmed me that the device is having custom ROM, if it matters. Anyhow, this is a complete stack trace: java.lang.RuntimeException: Unable to start activity

onLocationChanged() never called

旧时模样 提交于 2019-11-30 00:30:33
问题 I am writing a code that brings current location but it is not giving me the location because it never calls onLocationChanged() .Is there any way to find the location. mobileLocation is coming 0 for this case, so the execution goes to the else block. My code is public class FindLocation { private LocationManager locManager; private LocationListener locListener; private Location mobileLocation; private String provider; public FindLocation(Context ctx){ locManager = (LocationManager) ctx

android: how to fix gps with mock(fake) coordinates?

送分小仙女□ 提交于 2019-11-29 23:24:06
I'm trying to fix GPS programmatically when the GPS signal is not available. I want to do this in order to provide mock coordinates to other apps like google maps and others. I tried to use GPS_PROVIDER and NETWORK_PROVIDER but only with the latter I can get a new location valid for google maps. But this works only the first tima and if I want to re-fix more mock locations google maps doesn't see any change... why?? I have to do a service for what I want to do? public void setLocation(double latitude, double longitude) { //mocLocationProvider = LocationManager.GPS_PROVIDER; mocLocationProvider

Unable to retrieve location using 'LocationManager.NETWORK_PROVIDER' even when WiFi is enabled in device running android M

此生再无相见时 提交于 2019-11-29 17:26:21
I'm trying to retrieve location using LocationManager following this tutorial. I'm running the code on an android device running Marshmallow and I have checked the permission and running below code once the permission is granted. Here's my code: public Location getLocation() { try { locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); // getting GPS status isGPSEnabled = locationManager .isProviderEnabled(LocationManager.GPS_PROVIDER); // getting network status isNetworkEnabled = locationManager .isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (!isGPSEnabled &&

getLastKnownLocation return NULL using GPS_PROVIDER and NETWORK_PROVIDER

感情迁移 提交于 2019-11-29 15:41:31
This is my GPSTracker constructor class: public GPSTracker(Context context) { this.mContext = context; locationManager = (LocationManager) mContext.getSystemService(LOCATION_SERVICE); Location gpsLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); Location networkLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); } gpsLocation and networkLocation are always NULL. getLastKnowLocation method doesn't return me any Location... even if I'm sure that few second before lunching activity (and creating GPSTracker object) the device had network

How does getAltitude() of Android GPS Location Works

徘徊边缘 提交于 2019-11-29 14:32:22
问题 HI I tried to implement a simple GPS tracker. Therefore is used lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, this); Then i used the public void onLocationChanged(Location location) { method to read the altitude of my current location. But i dont really know what Location.getAltitude() returns. The document says it returns the altitude. But is this in meters? or feets? if i put the phone on the desk next to