获取方向Android应用的用户为首的进入地理围栏 [英] Get the direction Android app user is headed on entering a geofence
问题描述
我在玩弄地理围栏 - 我想要做的是当一个地理围栏被触发,弄清楚他们要去的方向是什么
I'm playing around with geofences - what I'd like to do is when a geofence is fired, figure out which direction they're going.
例如 - 让我们AY我想设置围绕卡弗斯地理围栏。同时降低州际公路向北,当我输入我想弹出一个通知,说地理围栏卡弗斯,采取正确的下一个出口,并作出正确的航向东。
For example - let's ay I want to setup a geofence around a Culvers. While driving down the interstate heading north, when I enter the geofence I want to pop-up a notification that says "Culvers, take next exit on the right and make a right heading East".
但如果他们在跨境南行车,应该弹出,并说卡弗斯,采取下一个出口在右侧,使左向东。
But if they're driving South on the interstate, it should pop-up and say "Culvers, take next exit on the right and make a left heading East".
这并不是说整个有想法的最好的例子,但希望。
Not the best example, but hopefully that gets the idea across.
的几点思考我有:
1.一些GPS或融合的位置请求,并利用这些来确定用户的发展方向。
2.使用传感器来确定手机正面临着什么方向。
- 不过,我觉得,所以我不,如果它很容易得到这些信息真正熟悉从来没有使用这些API
A few thoughts I had: 1. Make a few GPS or fused location requests and use those to determine where the user is headed. 2. Use the sensor to determine what direction the phone is facing. - I've never used these APIs though so I'm not really familiar if it's easy to get that info.
在这些想法的思考?更好的建议?
Thoughts on those ideas? Better recommendations?
谢谢!
推荐答案
我会使用<一个href=\"https://developer.android.com/reference/com/google/android/gms/location/FusedLocationProviderApi.html#getLastLocation%28com.google.android.gms.common.api.GoogleApiClient%29\"相对=nofollow> getLastLocation 然后 getBearing 但我没有想到丝丝入扣。
I'd use getLastLocation and then getBearing but I'd not expect great accuracy.
这篇关于获取方向Android应用的用户为首的进入地理围栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!