Genymotion GPS is not updating - android

I have installed genymotion along with the google play services. I have installed Google Maps using the apps store and i would like it to update my location to either my current location or a fake location i provided. The reason is that i am trying to test an app that uses the google maps api.
Device i created is a Galaxy S6 -6.0.0 - API level 23
Settings > Personal > Location > High Accuracy is on
GPS for the emulator is ON and the location is set. When i go back to my app however, it is not updating the location on the map.
Is there a way to inject the location with geny shell or?
EDIT : I can also access my maps app from the browser but I get the following:
1) website wants to know your location? I press share location
2) This site cannot access your location. Change this on the Settings > Advanced > Website screen
There is nothing to do here except clear location preferences for individual sites.
Any help or advice is appreciated.

For anyone retrieving getLastKnownLocation on Genymotion in order to set a point on the map or something of the sort like this:
LocationManager locationManager = (LocationManager)getActivity().getSystemService(
AppCompatActivity.LOCATION_SERVICE);
// First try and get last location from network provider
location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
// If that doesn't work, try the GPS provider
if(location == null) {
location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
}
Setting the device lat/lng through the GPS widget or the Genymotion shell does not automatically update your lastKnownLocation the device. I had to manually open Maps, let it update to the specified position in order to set lastKnowLocation, and it worked from there.

Related

Getting last known location from Google Play Services while device location is off

I'm using FusedLocationApi to get device's last known location from Google Play Services.
My understanding is that getLastLocation delivers the last known location (assuming the needed permissions are granted) regardless of which app has requested the location even when the device location is off but does not work as such.
When the location is on it works as expected; But when it's off it returns null though it has previously retrieved the location for example from the Google Maps app.
Should it work like this or something's amiss here?
When you turn off a location provider on the device (GPS, Network, etc), it clears the last known location. Any apps that still shows a point of some kind when location is turned off probably cached it.
So the answer is that you should receive null for getLastLocation if location services is turned off.

Current Location using Location Manager in android studio emulator

I am developing an app that get user current location using location manager or google places api. Using google places api I can get location in both emulator and real devices.
Working with current location in android emulator
For me it returns null.
Note: It was my fault that I didn't set lat and lon on emulator
Yep, That is something you gotta see, Even Bluetooth Does not work Well.
On to the Question:
Start your Emulator.
Press the 3 dots at the bottom.
Go to the GPS Section.
Write the Latitude and Longitude
Press Send!
Done!
It was my fault that I didn't give any lat lng in my emulator. Or may be didn't tap on send button or may be internet problem. But there was problem

Secure GPS location in Android App

How to ensure secured GPS location in Android app. There are so many "Fake GPS" applications lying around on the internet. I have to build an application which uses the GPS location of the user. Is there any way I can ensure that the GPS location is never wrong (or tampered/fake)? Please suggest.
If your minimum sdk level is >= 18, you can use isFromMockProvider() method of the Location object to check.
Hope this helps.

Android Mock Location "Teleporting"

I've been trying to get mock locations on my OnePlus One working for quite some time now, but I have unfortunately been unable to determine the cause of this. Essentially my issue is that when setting a mock location, they do work, but for some reason my location appears to "teleport" between where I set my mock location and my current location. I've been using Google Maps to test my current location. Following the guidance of this answer, I set my location mode to "Device only", but it appears to still be happening. Furthermore, I turned off WiFi completely, to no avail.
The app I am using to spoof my location is here. I've tried other apps to the same effect. My phone is running the latest CyanogenMod 13 snapshot (20160419).
If anyone would happen to know how to solve this, it would be much appreciated :)
The steps given below worked for my Nexus 6:
(I have assumed that your device is rooted. If not you need to root it first)
Install Xposed framework. You can use the tutorial here.
After Xposed is installed go to its Download section and install the module Mock Mock Locations. Then go to the Modules section in the Xposed app and activate the downloaded plugin(needs restart).
In developer options select the mock location app you are using in Debugging->Select mock location app
Download the app Disable Service. In the app select the System tab search for the service named Fused Location and disable it. Also search for the service group Google Play Services. Inside it there will be another
Fused Location service. You need to disable it too.
If it is still not working try disabling Google Location History as given here. Also set your GPS accuracy to Device Only.
Install Fake GPS Location app in your Android device and set your desired location inside the app. Your device will behave as if it is at the location you have set. Don't forget to select Select mock location app in Developer options in your device Settings.
In case someone has issues with mock location software to get working:
override fun onLocationResult(locationResult: LocationResult) {
var LastLocation: Location = currentLocation
if (LastLocation.longitude > X.XXX && LastLocation.longitude < X.XXX && LastLocation.latitude > X.XXX && LastLocation.latitude < X.XXX) {
LastLocation.latitude += Y.YYY; LastLocation.longitude += Y.YYY
}
X.XXX is a placeholder. Set a bounding box for your ow current location to shift your location to the new destination by changing Y.YYY
With something like this, you could shift your location and simulate hardcoded from your home/office location your desired location.

What's location provider "passive"? Seen on HTC Desire with Android 2.2

Before I go into location based mode I check for existence of any location providers by calling
List<String> android.location.LocationManager.getProviders(boolean enabledOnly) //enabledOnly = true
and checking the size of the resulting list.
Now I tested my App on a HTC Desire with Android 2.2. The system settings don't allow any location tracking (GPS and mobile is turned off).
However, the list get returned has 1 entry, whose value is "passive". What is it? Can I work with it? The provider seems to be slow / not working.
From the Android API reference:
A special location provider for receiving locations without actually initiating a location fix. This provider can be used to passively receive location updates when other applications or services request them without actually requesting the locations yourself. This provider will return locations generated by other providers.
So no, it's not likely to do you any good if there are no other location providers available.

Categories

Resources