本文介绍了Android:制作地理围栏的简单方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我是Android开发的新手,并且正在创建一个应用程序,该应用程序允许用户在特定位置周围创建提醒的Geo围栏.例如:在杂货店周围做一个地理围栏,以提醒用户进入时要领取橙汁.

I'm new to Android development and am creating an app that allows a User to create a Geo fence around a specific location for reminders. For example: Making a geofence around a grocery store to remind the user as he enters to pick up Orange Juice.

有人知道一个教程可以帮助开发这样的东西吗?

Does anyone know of a tutorial that could help in developing something like this?

推荐答案

AFAIK没有用于地理围栏的教程,但这很简单(假设您需要圆形围栏).

AFAIK there are no tutorials for geofencing, but it's pretty simple (assuming you want a circular fence).

  • 本教程将告诉您如何获取用户的位置
  • >
  • 任何链接都将向您展示如何计算其当前位置与栅栏中心之间的距离
  • 以固定的间隔计算它们到中心的距离.我会让他们通过设置屏幕来设置时间间隔,并以默认的五分钟左右开始,因为除此以外的其他任何事情都会消耗大量电池.每次获取时都存储该距离.
  • 如果他们的最后距离与新距离相比越过边界,请执行操作.例如,我开发了一个应用程序,该应用程序可以在孩子离开朋友家或上学时向父母发出警报.
  • This tutorial will tell you how to get the user's location
  • Any of these links will show you how to calculate the distance between their current location and the centerpoint for their fence
  • Calculate their distance from the center at regular intervals. I'd let them set the interval through a settings screen and start with a default around five minutes because anything more than that is a hefty battery drain. Store that distance every time you get it.
  • If their last distance compared to their new distance crosses the boundary, perform your action. For instance, I worked on an app that would alert a parent if the child left a friend's house or arrived at school.

这篇关于Android:制作地理围栏的简单方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 14:48