Geo Fencing in Android - android

I am trying to build geo fencing in my android application. however i am not clear with this idea. whenever user opens my app, i want to see if he is in any AMC theater. how do i do that? should i use latitude longitude values or i should use physical address? if i use lat lon values how accurate will the output be? if i go for physical address, how time efficient will it be?
i have currently written a code wherein i have hardcoded the values. but thats not going to work for real app. my app can track users coordinates but i am not clear how this data can b put to use.

You need to use latitude and longitude, with very less accuracy (may be 20meters or less), and just look for Satellite GPS coordinates. If the device gets a satellite GPS fix, it would have very good accuracy (sometimes as close as 5m), and based on that, do whatever task you want to perform.

Best bet is to get the lat/lon coordinates of nearby AMC Theaters from the Google Places API. Calculate the distance to any of the points and use a threshold to determine if you're in the general vicinity of the building. The geolocation point is bound to be on the edge of the building, not the center of it (or perhaps even on the street), so it's unlikely you can just use a simple radius from the point.
For geo fencing, the best bet is to scan for the WiFi networks in the area and if any match the properties of your desired location, then you're in it. Of course, good luck getting that data. The other thing you could do to ensure users are in the venue is to plant NFC tags in the building and have them scan the tags. Again, this may only be feasible if you're doing a contract for AMC. QR codes are too easy to duplicate. Anyone could take a picture of one and scan it at any time.

Related

Fetch accurate intermediate Location points in background and calculate Distance of Starting and ending locations in Android

There may be similar questions regarding this topic,But I need your thoughts and suggestions on some specific requirement.
Here is my need -
We are developing one app which tracks User's trip.
The app will start collecting the location of that user in background,When user 'Starts' his trip from App.Background Service will be fetching locations on the basis of user's movement in specific time duration.
When User 'Stops' his trip from App,We are calculating distance traveled by user with help of all recorded locations(With Google Distance calculating API).
The App works fine in ideal case.
But main challenge is -
In some scenarios,We are not able to fetch exact and precise location of User. Scenarios affecting is - No internet,Data plan with 2g/3g,some specific areas where GPS is not returning accurate data etc.
Incorrect data of lat-long causes incorrect Trip distance and route.Which is main problem with the App.
Please,any one can suggest the best alternative/Suggestion for this?
P.S. - We have tried GPS,Network,FusedLocationProvider.
EDIT 2 --
We have implemented logic on basis of accuracy and distances.Got nearer points. And just came across one useful api from Google that corrects some location points which are distracted from actual Roads. Posting here for reference of others...
Snap to Roads Api from Google
this is a complicated topic.
One consideration you have to take. Android Oreo limits background services and that what you want to achieve won't work.
I would do is this (and it is the recommendation from Google)
When someone starts the trip (the user is aware of it), you must launch a on going notification with a foreground service , don't rely on background services anymore. Check the feature "Start Activity" in Google Fit App.
As for not having signal, or accurate GPS, well... it is a geographical problem!, there is nothing you could do. Or, maybe you can, using the LocationProvider.
FusedLocationProvider is fused within every app that requests locations updates.
Read this out, and see if that helps you.
https://developer.android.com/guide/topics/location/strategies.html
Try to mix GPS and Accelerometer
If you detect that GPS stopped working, turn on accelerometer. If GPS is turned on again, calculate distance again with it. This way you can have route with GPS parts and accelerometer ones. The bigger GPS parts, the more accurate data will be
How to get more accuracy by GPS_PROVIDER
Basically if the accuracy of a location isn't acceptable throw it away. The next one will be better.

How to find if you're facing a certain location in Android?

I've searched online but haven't yet found anything like this. Basically, is there a way where I can know if I'm facing a certain location.
For example, I have my current location in latitude & longitude and I have a second location in latitude & longitude. Now I want to know when the second location is directly in front of me as I turn.
I'm going to assume that you mean the phone is "facing" the location of interest, and you already know which axis will determine this. What I would do is use the SensorManager.getOrientation(float\[\], float\[\]) to get the radians of where you device is facing, then convert it into degrees.
Next, I would ensure I get an accurate and current point from the device (GPS, not Network), and call Location.bearingTo(Location) on the location from the device with the destination location as the parameter to get the degrees to it.
Finally, I would compare the two results and determine if the device is "facing", within a certain range. This might have to be adjusted based on how far the destination is from the current location, but I would experiment with this a bit.
You can predict your direction/location if you use Android location Manager. Take a look at this example
I don't know if this help, but you could take a look at the Places API from Google: https://developers.google.com/maps/documentation/javascript/places#place_search_responses
The response has an attribute called viewport that with some processing can help you

GPS tracking within vehicle in android

I am in need to develop an android app where the device will track the distance traveled while the user is in a moving vehicle. I am getting the GPS values at small interval so that I can retrieve the distance and sum them up. But the problem I am facing is, while the user is in the vehicle, the device is not getting a clear view of the sky. Hence, the GPS device cannot get values as frequently as I desire. Thus, the result produced contains huge fluctuations. I tried using the network provider, but that is even worse in this scenario.
It would be very much helpful if anyone can suggest me a solution to this problem.
Just put the receiver onto the inner side of the windshield, like all navigation systems do. This should give an acuracy of about 3-6m. (when SBAS correction is available in your location) or up to 10m if not.
If the receiver is not state of the art (combined GPS + GLONASS or BEIDOU) then you will have problem in cities, especially in urban canyons with location jumps up to 30m.
This is normal. To get correct result for a GPS application within a city you need advanced algorithms. Just summing up the distance between two consecutive locations is to primitive, this never works well. Distance calculation by GPS has be answered some times her at SO. Use the search engine, to get more info at that topic.
Of course, set the device to GPS provider only, with maximum precision.

Android - how I can I achieve location accuracy in Google Map

I am self learning Android programming at the moment. I was about to write app that will display my location on map without using GPS.
I have tried using NETWORK_PROVIDER and found that my accuracy is constantly at 2000 even in city area with a lot of wifi around the area.
I would like to know how could other map application (e.g. GoogleMap) is able to achieve high accuracy without using GPS.
They use GPS. Or they lie about their accuracy. Ever seen the big blue circle around your position in Google Maps? That means they think you're somewhere in that circle, and are guessing about actual position.
The only way to get accuracy is to use GPS/GLONASS signals. A-GPS can help to fix position quickly because it provides info about which satellites are in view from your phone cell position (your device don't spend time trying to get signals from satellites not in view).
The 'High accuracy' mode is just a lie from Google to know your position all the time to monetize you in perverse ways
If you are using the network provider to fetch the location they are not very accurate. SO its not a good idea to fetch the accuracy of your position using
network provider. Its best to use GPS to get the location updates. You can use GetAccuracy() method of Location class and see for the value it returns.
Let Say if getAccuracy() retruns 25 then you can leave this value wait for another gps value which is more accurate.

how to get the most accurate location using GPS and AGPS with given time in android?

I have a below requirement.
Find location of user from GPS and AGPS. (we are going to use Samsung Galaxy ACE mobile phone)
Note: For every transaction first location will be the reference location for the next activities.
Below are the constraint which has to be considered while solving this problem.
user should be within 10meter range of the reference location. meaning (Reference location - current location) <= 10meter (distance calculation by Locaiton class API).
Location has to found in the given period of time.
let say 20-25sec for finding each locaiton. the time can be extended to max 35sec.
My user is always be outside of the Shop while taking the reference location and then inside for all the other activities.
What I am doing
find the reference location with accuracy of 30m with 25sec of time. store this in static variable.
find the location for next actiivty and calculate the difference. if difference >=10m tell user to perform that activity again.
My Queries
Is this possible with such fine accuracy in the distance with given Time and place?
How google calculate this distance?
Does google finds the location with such accuracy? or what is the accuracy of Google Map using GPS? for e.g. at given particular time and location given by the Google MAP by GPS how much it is accurate? like if i am standing near to my BANK then what is difference between co-ordinates on the google map on the server and the co-ordinate given by google map through GPS on mobile phone.
I have did enough experiment on this problem and finally came here for help.
i did the observation by doing variation in timing, place, accuracy. still need to find one final solution. as we have to answer the client whether it is possible or not?
The GPS can provide most accurate match but only outdoors. It is possible to achieve such accuracy but not guaranteed.
There are formulates for finding distance between two points on a sphere. However, for rough approximations euclidean distance can be tried.
The location and its accuracy depends on client side GPS. Google just reads it.

Categories

Resources