I want to ask a simple question.
How does Google Fences API (https://developers.google.com/awareness/android-api/fence-api-overview) work? Espescially the activity recognition.
Thanks
As the Fence API Overview mentions:
...the concept of "fences" is taken from geofencing, in which a
geographic region, or "geofence", is defined, and an app receives
callbacks when a user enters or leaves this region.
The Fence API
expands on the concept of geofencing to include many other context
conditions in addition to geographical proximity.
An app receives
callbacks whenever the context state transitions. For example, if your
app defines a fence for headphones, it will get callbacks when the
headphones are plugged in, and when they are unplugged.
In basic terms you define a geographical area (defined by GPS coordinates) so that when a user enters or leaves this "geospace" a notification is sent out. See the following image
Related
In Android, using Google Maps API v2 Intent, is it possible return to my app after the user arrives at his destination using navigation?
Thanks!
Not sure why you would want to do that. But one possible solution could be:
Get location updates in background using some Service.
Use GeoFencing.
As soon as you detect you are at your destination using GeoFencing, either a) You launch your Activity from the Service (which is not a good UX at all as the user will be disrupted from his Maps experience), or b) You show a notification to the user and user can launch your app from that.
Beware that starting Android O, the frequency of location updates you get while on background is very limited. One possible solution would be to know how long it will take the user to reach the destination and plan your location updates accordingly.
I want to know that is it possible to use geofencing feature without any app installed? is there some cloud or something which you can register your geofencing area so anyone with the location on can see your notifications??
I don't know about Android, but for iOS you can use Apple Wallet Passes. You can attach up to 10 locations (geo points) to your passes, and when the device that installed the pass is near one of those locations, the pass will appear on the lock screen.
Relevance Information Displays Passes on the Lock Screen
Passes let your users take some action in the real world, so accessing them needs to be easy and fast. Wallet makes relevant passes immediately accessible by integrating them with the lock screen. To take advantage of this feature, add >information about where and when your pass is relevant. A pass’s relevancy can be based either on the time or the place where the user can actually utilize it. For example, a gym membership is relevant at the gym, while a boarding pass is relevant at the time the flight begins boarding.
Inside the pass, you provide a point in time and points in space. Wallet then determines whether the pass should appear on the lock screen based on these settings. It calculates when the user is close enough to the specified time and locations based on the pass’s style. Don’t try to manipulate the pass’s presence on the lock screen by providing inaccurate relevance information.
Of course, integrating with Apple Wallet requires your own web server, and is not a simple task. However, It doesn't require any app installed, which is what you asked about.
I am opening google maps application from my app using implicit intent for navigation.
I want to know that if there is a way to send back a flag to my application from google maps when destination is reached.
How to get a callback from google maps in Android application, when navigation is complete
I did get an answer on this from above question but again its by checking onLocationChanged function that I do not want to use. Reason I think for that is that I will duplicating most of the task that is already being done by google maps resulting in consuming more battery and resources.
Is there any action called at destination reached which I can implement in my app to initiate an activity or any other way to get a flag back to my app..?
Thanks in advance! :)
You can create a geofence and add it to location services. It will notify you (callback) when a user enters or exits in a particular geofence.
Geofencing combines awareness of the user's current location with awareness of the user's proximity to locations that may be of interest. To mark a location of interest, you specify its latitude and longitude.
Try to read this documentation: Creating and Monitoring Geofences
I am making a geofencing application, which must trigger notification constantly while the device is outside the geofence, not only on exit.
I have tried using Geofencing API through the training example given in Google android developer training page. But, I got notification only when the device enters, dwell or exit.
According to what I have researched till now in both SO and google, there are only three types of transitions handled in Geofencing API: Enter, Dwell and Exit. And the notification starts only when device enters the geofence, till it exits.
Can anyone help me out how to make it work?
That is not possible that way. It does not make any sense outside the geofence area. That is not an usecase of geofence.
You can try to specify broader range of the area and then check the geocoordinates if this is outside of your area you want to have.
Incase you want your own custom exit trigger, when you are outside the fence. You can write your custom action by measuring distance(lat,long) between your current location(FusedLocationProvider) and the fence location (lat, long).
You can use below methods available in Android Location API to measure the difference and generate a custom trigger to indicate that you are outside the fence.
Typically this is what you need to do
if[ (difference in location) > (Radius of your geo fence) ] -> Custom Exit of Fence Action
distanceTo
distanceBetween (Provide both your current lat,long and your fence lat,long here)
In the Google play service request user activity document they given like, it will work only if the device has Significant motion senor.
But there are devices which does not have that senor also detects the user activity properly.
And also there are devices which is having this sensor also not detecting the user activity.
Is there any list of sensor needs to be available to detect user activity using Google play services.
Please help me on this.
it mainly uses the location services to know whether a user is moving or idle like it used in google maps to know the users proper location