Android:制作地理围栏的简单方法? [英] Android: Simple way to make a geofence?

查看:96
本文介绍了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:制作地理围栏的简单方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆