How to use android network location without Gapps? - android

Okay, so I removed all of Gapps from my android 4.1 phone.
My GPS can no longer be determined via wifi or towers.
(Is this because networklocation.apk depends on Gapps?)
Does anyone have a solution to enable network location without Gapps?

Related

Android location incorrect

This is my case. when the mobile signal is too weak one or two bars. The phone will connect to wifi automatically. After that, when the app try to acquire location. The location is always incorrect. is that gps signal issue?
Rather than trying to use your GPS chip to find your device, Google’s servers “remember” the GPS locations of devices connecting through your router (presumably by associating your location to the router’s MAC address), and “assumes” that all devices connecting through that router are at the location which it remembered. The complete details can be found via below link.. http://redoubtsolutions.com/android-reports-wrong-location-when-connected-to-wifi/

Working with GPS via libhardware on Android

In AOSP there is libhardare library which contains interface to the GPS driver - gps.h. Using this interface you can get access to GPS driver on low level (C++), turn on GPS and get current location of the device.
On the Internet there are several projects, that use this GPS interface. For example, this one created by kanru. This code works almost perfectly - I could connect to GPS driver and get correct location.
But I ran into a problem. If you turn on GPS driver using kanru project and after awhile turn on GPS via standard method (in GUI), then C++ program will suddenly stop receive information from GPS driver. At the same time in GUI you can see that GPS is On and you can start Google Maps or any other GPS-related application and get your coordinates.
I tried to restart GpsInterface, turn off and on GPS driver via hw_device_t pointer, even restart whole C++ executable - no effect.
After restart of the program GPS driver change status to GPS_STATUS_ENGINE_ON and then - silence.
Also I tried to change the order of actions. I turned on GPS in GUI, launched Google Maps and waited several minutes till I got my location. Then I started my C++ program. It successfully connected to GPS driver and started to get location data. Meanwhile GUI "lost" connection with GPS driver.
I tried to test my program on several devices with Android 4.2 and 5.1 and get same problem on the most of them. Only on Samsung S6 with Android 5.1 my program was able to work perfectly under all conditions.
It seems like on some devices GPS driver configured so that it can work with only one data consumer.
Perhaps someone faced a similar problem?

How can we detect location without GPS or WiFi?

We have an interesting use case where the intended device does not have GPS embedded in it. Nor will it be connected to any cell towers.
The only connection the device has to the outside world is through the web. But there is a high probability that the network location is in different city showing the wrong address...for example user is in CA but the network being accessed is located in MI (thus showing the user's location in MI).
Does the Android SDK contain an API that can serve as a workaround to this scenario?
IP Geolocation should work, unless when you say "network being accessed" you mean that the Android device creates a VPN tunnel to MI.
The Google Maps Geolocation API will also work off of wifi towers that the device can detect, so local wifi signals may be able to pinpoint the device location.

Has NETWORK_PROVIDER behavior changed in Android 4.1.1?

I have an existing well-tested app that utilizes the GPS_PROVIDER and NETWORK_PROVIDER with the same LocationListener.
LocationManager reports gps, network, and passive location providers are available and enabled.
I have recently upgraded my Galaxy Nexus to 4.1.1 and now the NETWORK_PROVIDER does not deliver any location changes. Testing with an Galaxy S III running 4.0.4 works as I am accustomed to, with network location updates coming through, even if WiFi is turned off. When WiFi is turned off, I get the cell tower position.
Talking with colleagues here, I can't rule out some kind of coincidental hardware failure or some sort of default setting change that I haven't found. I've double checked throughout the settings and it appears that everything is properly set.
WiFi is on, Cell network is on, GPS is on, network services are all enabled. I have no GPS signal at my desk, so it's easy to notice when the network location fails to provide a result.
Anyone else running into similar issues with Verizon Galaxy Nexus + 4.1.1, or 4.1.1 and any phone?
As an additional wrinkle, Google Maps is finding my location, but my PASSIVE_PROVIDER is not generating a location either.
The behavior of Android has not changed with regard to the NETWORK_PROVIDER.
I don't know what went wrong or why, but I removed/replaced the battery and SIM card on my Galaxy Nexus and the network provider seems to be providing the correct results.
The lesson for me? Do not assume you will ever get a location reported to your listener, even if you are certain that the network provider is available, enabled and connected.
In my case, I'll need to add another check to make sure my LocationListener does not keep running if I do not get any locations reported.
I have read someone's supposition about this problem.
It is "In some devices if there is no update after request then a network provider do not give a callback".
Consider that possibility.
In my case, I use a getLastKnownLocation() before starting a current location tracking.
Try ctrl+f getLastKnownLocation in this article.

How can I force Network Location?

I want to turn on the Network Location ("Wireless networks" - Location determined by Wi-fi and/or mobile networks). Is this possible?
In my application, I can force 3g connection (only in Android 2.3+, I have problems with WRITE_SECURE_SETTINGS on Android 2.2) and GPS Location.
Thanks,
You can do it via root methods if you must, however, I would recommend prompting the user in most cases.
See Android get location or prompt to enable location service if disabled for prompting. I'm really not sure about the root method but it is documented somewhere on the XDA-Forums I'm sure.

Categories

Resources