I need to get current location in China but current location manager is not working in china.Its not showing latitude and longitude. Please tell me how can I get this? Many Thanks
Fact 1: All Google services are blocked in China.
Fact 2: Although it gives a feeling that AOSP is nothing to do with Google, it's really not.
The truth is that once you used NETWORK_PROVIDER to get a location, a message was send to Google location server to check out the location, and returned the location back to you. For the reason every Chinese knows about, you can't access the server, that's why when you combine NETWORK_PROVIDER and GPS_PROVIDER together, debug codes in a room, nothing get returned(GPS is not accessible in a room).
Solution:
Use android ROM modified by Chinese company like XIAOMI, MEIZU etc. These ROMs modify the framework and redirect the NETWORK_PROVIDER message to other servers.
Use some third-party location service like BAIDU location SDK.
Related
I'm working on a GPS game, similar to geocaching, which requires the devices accurate GPS cordinates.
I am using LocationClient and not LocationManager.
Early in testing, a friend pointed out that the location can be faked using free apps on the play store. A bit of research shows that without root, these apps require Mock Location to be enabled. So I started with a simple check to see if mock location was enabled, and if it was then the app would not allow the user to play until it is disabled.
This got me thinking though, users who are rooted could still fake their location without having mock location enabled, however most of these apps still have the MOCK_LOCATION permission regardless if the device is rooted or not. So I used a method that detects any apps that require Mock Location. The problem is, even on my non rooted Note 3, there appears to be several pre-installed apps that require Mock Location for some reason, which then prevents game play. So this solution wont work.
Is there any other way to check if a location might be faked using LocationClient?
In API 18+ you can use Location.isFromMockProvider to check if a particular location is mocked. This flag will be set to true if an app is providing mocked (fake) locations or if you are using a mock provider in your own app.
Of course, rooted phones can bypass this.
In your device, go to settings >> developer options >> allow mock locations
This option must be checked in you device that's why you are getting mock location updates. To stop receiving just uncheck it.
In your code, you can also set mLocationClinet.setMockMode(false); in your onCreate() method of Location tracking activity.
I hope it works :)
I want to know if gps can be used to get the latitude and longitude of an address.I've just began to work on gps on android.My problem is that if the user does not have internet connection, i want him to be able to get the latitude and longitude of an address.Can gps do that or it is only used to get current location.If not are they any other way of getting this done.I;m using google maps and i've also tried to get geocoding as mentioned in some posts,but it does not work.
From your question,
If you are using Google Map and GeoCoder class that means you must have Internet connection. And moreover when you are working with GPS, again you must have Internet Connection. If you are using GPS_PROVIDER then you required open sky type environment and for NETWORK_PROVIDER you can fetch gps details inside a room,but for both provider Internet is must.
You are missing the point of what GPS is designed to do.
Your phone's GPS doesn't do anything with an address. All GPS does is get the latitude/longitude of your current position, nothing more. The phone (via an internet connection) is able to identify your address based on the Latitude/Longitude that the GPS provides by using 3rd party provides (such as Google Maps)
It sounds like you just want to get the latitude/longitude of any address, not just for the device's physical location. That does not require GPS at all. But it needs an internet connection in order to access a provider to perform the geocoding.
A answer I provided to Does GPS require Internet? is a somewhat related to your issue. The 2nd to last paragraphs are pertinent here as well
While it requires a significant amount of effort, you can write your own tool to do the reverse geocoding, but you still need to be able to house the data somewhere as the amount of data required to do this is far more you can store on a phone, which means you still need an internet connection to do it. If you think of tools like Garmin GPS Navigation units, they do store the data locally, so it is possible, but you will need to optimize it for maximum storage and would probably need more than is generally available in a phone.
So effectively, you theoretically could write your own tool, cache data locally and query it as needed, but that not something that is easily done.
How mdm solutions like Mass360, airwatch etc find the device location ? What are the possible ways to find android device location from a web console. I expect the result to be accurate.
I am currently using mqtt for communication between web console and android client. whenever the location changes, i send the latitude and longitude using mqtt. based on that the location is updated. But getting the latitude and longitude seems to be inaccurate and changes even if the device remains in the same location.
Help me with this. Thanks in advance.
This needs to be tracked form the agent app you are installing. Simply try to maintain the stale communication between mdm server and the agent app. You may use MQTT or any other push/polling mechanisms here. Always try to reduce the network calls and only update the location if necessary. Otherwise this will drain the battery.
I have make an android application which help us to get GPS Location using A-gps in my android phone. I am getting latitude and longitude successfully in Metro Cities of my country, but when I am going to some forest area,GPS do not get location and for this I need to run GPRS of my phone,after running google map once in my phone ,GPS successfully gets latitude and longitude even if I closes my internet connection or remove sim card from my phone. But since I do not want to use google map, what should I do now and why it is happening?? Any help will be appreciable
It takes a long time (several minutes) to get the GPS location with high precision. However, if you enable network based location (e.g. cell tower, WiFi), it's way faster but with lower precision.
As a result, you should listen to all the providers with LocationManager, and figure out which provides the best location. Or, if your app targets Android 8 and above, you can use the Location APIs provided with Google Play Services, which hides the details as using LocationManager directly.
First make sure that it is not the fault of your phone or its operation system version.
Download a well working known GPS App, look if they get a GPS signal without internet.
Place it under very good cointions: free view to sky, outside dense city, at least an open place.
You should get a signal within one minute, maybe if the phone has a poor built-in GPS antenna, a bit more, wait some minutes.
If the well working foreign app still don't get GPS it's an Operating system bug.
If you get one, then it´s your fault, and it is worth for further investigation.
*first check your GPS working or not properly with **ANDROITS GPS TEST*.
if it finds and fixes satellite do not worry. as AGPS is fast , standlone GPS needs to have much more time to fix on its own especially in city as many radio waves disturbs GPS fixure.
better first fix with AGPS and then you can turn off data or internet, still it will work as it already had its location and satellites fixed.
with standlone GPS it takes huge time and battery.**
If your phone use GPS h/w to get the location information, it don't require any internet connection. It should be able to get the location fix using GPS without the help of internet. But it may take some time to get the location fix.
You can install the this free app from play-store to test the GPS of your phone : "TestYourGPS".
https://play.google.com/store/apps/details?id=com.eorsavik.testyourgps
I try to receive latitude & longitude on android phone.
Is location on android receive directly from satellite?
Why it dynamic all the time, while I standing though?
So, anyone know how to make it stable ?
Thanks
The location may come from a variety of places:
The "last-known" location, an OS-level cached location (fast, but may be inaccurate)
The wifi network (Google can often deduce location from the wifi net you're on, but not always)
Mobile network - if the device is on a mobile phone network, that can provide location information
GPS receiver. If the device is outdoors this will provide the most accurate location
Your app will have specific needs, and so you need to decide which locations you want, and what you do when you get them, based on their accuracy, and the source.
With GPS, buildings, tees, the weather, etc will all have an effect on the location, so you'll never get one amazingly accurate location. Many apps just request a location and use it, but if you need accurate, stable location data, you need to collect data from relevant sources, and then use your own algorithm to decide which to use.
You need to read, understand, and use what's in this page:
http://developer.android.com/guide/topics/location/obtaining-user-location.html