Unable to understand android location feature - android

In my app I need to determine user location. So I am using location manager. In my code, I first check for availability of network provider and GPS provider. I prefer networkprovider first, else I use GPS provider to get the location.
In an android device, there are three options available for location setting:
high accuracy(gps+wifi+mobile network)
battery saving(wifi+mobile network)
device only(GPS)
When within my house(WIFI on), I observe that first two options work but third one doesn't. So I ventured out of house(WIFI gone,no internet), and made observations again at a fixed point. There again, first two options worked but not the third.
Why is it so?GPS is supposed to work in open space.So I should get location for GPS too.
Then I got into a vehicle, and tested again. But now none of the options work.Even first two options stopped giving result.
Why this behaviour? I expect all three options to work outdoor. But GPS never works, and first two work only when I am stationery. Does movement plays a role here?
I am not able to comprehend the overall behaviour.

Related

Android Force Location of Apps

I work in QA for an company that helps market applications. Currently I have been tasked to ensure location dependent apps function if correctly (ie if im in russia the app displays the russian content and if i change to us the app updates to the us content)
I have tried numerous items to accomplish this but get no where.
What i have tried:
Proxy. Setting this up via wifi to several locations. Both the app and the device still show my current location.
Apps: I have tried all of the following apps and they all give the same result as above.
Fake Location
AutoProxy
Fake GPS
I have enabled developer mode on the devices, and have ensured that "Mock Locations" is checked.
Use case 1:
A developer whats us to test his app which is only available in england. Google Play still sees me in US
Use case 2:
A developer releases a game where the background changes based on your location if i cant force the location change I cant verify this feature works.
Im guessing the fails so far are due to the fact that the location being called in our test apps is network location not GPS?
Any help would be awesome. Even if you could just point me in a direction.
Thank you Greatly
J
Update:
Ok, Thanks to the answers about google play and mock locations. So with those in mind lets think about it from another perspective. If the app is not calling for mock location, Is there anyway to force a mock location override? im trying to cover all the bases here, One app for sure does not use this method, so I still need to find a way around.
depending on how they are calling for the location, I would think (remember im knew here) that using a proxy would work, however as stated above, i'm not getting anywhere there either. Did try a few free proxy's from hidemyass but even the browser wouldn't work with them.
Yes, network location does not get faked by mock location providers. I don't know why not, but it only fakes GPS. In addition, your app has to request the MOCK permission to get it. If it doesn't have this permission, setting a mock location will not actually fake anything to the app. This is for security purposes, so a malicious app can't start broadcasting the wrong location to the phone.

How to know gps fix is available or not?

I am working on app. When user click on button he will get current location using GPS.
All is working fine but one problem.
Problem
There might be some location where gps will not work...like closed area...and gps can not find location...at that time it will return previously know location...Previously known location may be too older or wrong.
so at that time I want no location found instead of last location.
Is there any way to check if fix is available or not ?

Never getting an Location (MvvmCross Location Plugin, Android)

edit: turns out it just takes waaay longer than the native implementation. :/
I'm trying to locate my position by using the mvvmcross location plugin.
Everything works fine as long as my device settings (Nexus 5) are set to "Energy saving", so no GPS will be used.
As soon as I set it to "High accuracy", I'll never get a GPS fix.
This happens regardless to MvxLocationAccuracy.
My current workaround is to check, whether MvxLocationAccuracy is set to "Coarse", and if so, set PowerRequirement to Power.Medium.
This will prevent Android from using GPS.
So my question is: what am I doing wrong? Why am I never getting an location, as soon as my device is using GPS?
I compared the mvvmcross plugin code to one of my native projects, which gets a high accuracy gps fix in a few seconds. Unfortunately I didn't find any errors.

Android - New Location / Geofences APIs

I've tried to run Geofences sample and I've got little confunsed regarding to how it works.
Prior to go on, I've studied the new APIs and wached this video:
http://www.youtube.com/watch?v=Bte_GHuxUGc&list=WLRNCZT9Eq_HTG5jIEFxMpdqoXZBNalekx
So I jumped coding it. I thought that this API would manage the GPS position's captures automatically, in order to get my position.
So at this point raises my doubt. I've only got notified within a geofence, if I turnned my google map app on so my device starts capturing my location thru GPS.
So, what should I do to have "my app" forcing GPS use ?
I appreciate your help.
Best Regards,
Marlus

How to get user's location?

I want to get user's location in my app. So, I read documentations and know how to get it work. But, if user haven't set "Alloy apps to use internet/GPS to get location" in preferences, my app crashes.
The only way I found is to show dialog that location settings are not enabled and to go programmaticaly to location preferences.
But is there another way to solve this? I saw many apps (like yandex.maps) that do not request this settings being enabled.
well, your app should not install if the user doesn't agree to the terms of use, and allow the permissions requested.
still you should check to see that there's a way to look the information up when you want it.
in your code, before the actual test for user's location, you should probably call a function that checks for all the location manager listings, and return false if there's no way to determine this.
if the function returns false, you should prompt the user and do nothing. else, you should do what it is you're trying to do.
try reading vogella's tutorial about using location manager
Refer this two links below and you might get your answer easily.
How do I get the current GPS location programmatically in Android?
android - how to get current location latitude and longitude
Hope it will help you.

Categories

Resources