I want to create an Android app with a simple concept : if 2 persons who have downloaded my app are crossing in the street, I want to send them a notification (immediately).
I started to use the geofences concept, but I don't know if it is the most appropriate. So my questions are the following :
Using the geofences (every user have his own geofence, so you are notified when entering an other user geofence), how can I make the geofence following the user when he is moving ? (with enough precision but without too much power consumption)
Is there another concept that is more appropriate to my problem than the geofences ?
Thank you :)
Since both persons are in movement, I think you need to call the position frequently and therefore it doesn't make sense anymore to use Geofences. Instead you would calculate the difference between them and push a notification from server when a certain threshold is reached.
if you want use geofences with server side will be more easy for app(in android u only can register 100 geofences) you can check in server the nearest users from you.
but if you need check user very close to you i think is better use Bluetooth, you can emulate ibeacons and the app can register beacon region and monitoring it. dont care gps signal and battery drain. In android you can use altbeacon open source lib for ibeacons/eddystone.
contact me if need more help and sorry my english ;)
Related
I know that there is a technique to update more than 100 geofence to google api client. But I want a complete solution to add more than 100 geofence or any library to achieve it. I already done my project using google api client. But there is limitation off 100 geofence only.
Is there any library or any other technique to update more than 100 geofence?
And all these process should run in background. I mean even after application process is killed, this should run in background. Is it possible?
Thanks in advance.
The issue with having more than 100 geofences is that depending on how close they are in proximity to the user and how many geofences you actually have, it can become a serious battery drain due to constant location polling. I'm not sure how you plan to implement your geofences, but I would suggest you look into loading only geofences within your immediate and surrounding area, storing the rest into a database, and loading/unloading depending on your current location and distance from the edge of the geofences. Bing came up with this nice tiling system that may come in handy for you.
Im trying to develop an Android messenger application where a message is sent by user 1 to everyone using the app, the message contains the GPS location of user 1. Is it possible to determine the distance between user 1 and the user 2 and based on that either choose to display or discard the message. How do I go about it? Cloud you point out considerations that I might have missed out?
Another method I believe is possible is to periodically update a server with every users GPS location and then let the server decide who gets the message, but I would not like to use this method as it would be a privacy issue. No one would want their whereabouts being tracked by a server all day. Is there another solution to this?
You can use the haversine formula to determine the distance between two locations. Here is a link that provides the formula in various languages.
http://www.movable-type.co.uk/scripts/latlong.html
One way of doing this is to store the most recent location of a phone on the server in the database. You can then query the database (using a stored procedure) to determine who your closest neighbors (phones) are by setting a radius. For instance, show me all the phones within 500 meters.
Here is an example of how to do this:
http://www.movable-type.co.uk/scripts/latlong-db.html
I am looking for an easy way to check if a user is at my location (50m) radius if notify me.
Right now I have a service running every two minutes getting position of each user comparing it and then notifying if user in same location.
Can this be done using promixityalert: http://goo.gl/9I857T?
Thanks!
Instead ProximityAlert I would use Geofences.
http://developer.android.com/training/location/geofencing.html
Is newer and does a more effective use of the battery
In your case, you can have a service that sends to the other device the current location every X minutes, so it can update the Geofence. The problem that I see is that there would be a lot of calls, spending battery and the data plan.
A good approach is to use the Location Services API, you can detect if a user is standing or moving.
http://developer.android.com/training/location/activity-recognition.html
Using this and sending new locations only when the user is moving you will be able to reduce the amount of calls.
Parse is another option as #thepace mention. It is easy to use and whit it would be easy to implement what you are trying to do, but is not free :(
Hope it helps.
Issue: Check if any user (multiple and variable location) is within specific radius of my current location(variable).
Solution:
1. Parse.com
a) Ensure every user has their location updated in Parse DB including yours.
https://parse.com/tutorials/anywall-android
b) Use push notificaitons: https://parse.com/docs/push_guide#setup/Android
1> Create a channel wherein only you are subscribed.
2> Create your installation query and send notification to it to the channel subscribed.
I am currently studying a possible project on Android and iPhone.
I need to know if geofences could help me, or if another method should be used.
I think the geofence are not used in this way but I ask anyway.
Is it possible to place a geofence on the current user location (even if it moves) and sending messages when other people come on the geofence position (even they are 100 000) ?
Thank you very much in advance for your answers.
It's do-able but you will be lagging a lot...you will have to get a strong server to get all the positions of the users at a given time and place a listener on each user location s.t. in case his geolocation gets into some geofence every listener should inform its listenee (which will probable be the user class), so far should be good BUT hypothetically 1 user can get into millions other geofences (indicating your start-up is running quite good...) which will require the server to send millions of alert, now think on a million users moving - that means that even if you send just their location you can end up moving a couple of tera-bytes in a second to the server and from it plus requiring it to make more than trillions actions (probabley push notifications?) per second...
It depends on many variables as: radius of your geofences, quantity of users, etc. Notice, that in normal life you never approach 100000 people at one time, well, maybe at the football game. I think nothing is impossible, but a lot of factors need to be reviewed.
Would it be possible to make an Android application that works based on location, for example when you get to work the app might turn off WiFi or Bluetooth or change any other system settings in order to save battery or something?
The app would require the user to enter in locations where they want the app to begin working, like their address, and when the phone sees that they have arrived at this location it will start working. I want to do this but I don't know where to start.
I already have some android app development experience.
Yes absolutely this is possible. I have worked on approx three application with same concept.
You need to create a center point and define a radius for the same.
Then you need to calculate the distance of you current location with that particular center point and if your distance is less than or equal to radius, trigger to switch on the services you want.
In android you can use
LocationManager class
For collecting the data. If you want some more help I can provide the same too.
I've played around with a concept like this on the Windows Phone for a while, and I think this would work for Android too.
Basically, you'd use the GPS of the device to detect your location, and then compare this to the locations saved by the user. If the location comes within range of a saved setting, perform an action.
GPS usage however drains battery, so you'd have to experiment a bit with making this an efficient method.
Have you tried GeoFencing, its really cool. It lets you define a center point, and a radius. Once the user enters this radius you get callback or a pendingIntent. You can do what you want in your callback.
You can get addresses of your customers and build geofence around their locations.
Edit :
If you choose to not use GeoFenceing (for what ever reason), note that LocationManager is highly buggy and unstable on most mobile phones (Samsung).
Instead use LocationClient, which takes care of all the crap LocationManager leaves with us to deal with and provides location faster, lesser battery and customized accuracy.
Edit :
If anyone tries to convince you otherwise, check this out. A video from google developers and their talk about why LocationManager sucks, and why they knew and helped us figure out the value Sensors add to the entire solution.
Edit : Design of your solution
You need 2 geofences
1) Outer, you can hard code this to a imaginary 500 m from office. From then on you can start looking for wifizones
2) Once a wifizone is found, save the gps and the distance from his address point. That is your inner radius.
1 Geofence is defined by your install, 2nd geofence is defined by your runtime.
2nd Geofence and be used henceforth to disable GPS (only incase you decide to use LocationManager). If not you wont need this, LocationClient will do what it does best.