非常简单的 Android 地理围栏示例

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26507424/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 11:38:07  来源:igfitidea点击:

Very easy Android geofence example

androidandroid-activityandroid-locationandroid-geofence

提问by prosk

I have tried to do the android developer training. However, my program is not working. I just want to register one simple Geofence like:

我曾尝试进行android 开发人员培训。但是,我的程序不起作用。我只想注册一个简单的地理围栏,例如:

mZielGeofence = new SimpleGeofence(
            "2",
            48.69421,
            13.88318,
            10,
            SimpleGeofence.GEOFENCE_EXPIRATION_TIME,
            Geofence.GEOFENCE_TRANSITION_ENTER
);

I don't want to use a database, because I only want to try to enter one specific Geofence, like the one above.

我不想使用数据库,因为我只想尝试输入一个特定的地理围栏,就像上面的那个。

Has someone of you found a nice tutorial, with an in detail documentation, or has a simple code example for me? I only need to add 1 Geofence and react to an enter event.

你们中有人找到了一个很好的教程,有详细的文档,或者有一个简单的代码示例吗?我只需要添加 1 个地理围栏并对输入事件做出反应。

Many thanks in advance

提前谢谢了

采纳答案by amstegraf

回答by Juan Saravia

The tutorial that you are using is excellent. What I can recommend you is a really awesome librarythat can help you to do it easily, it uses Google Play Service and Fences. I already tried it and it works excellent.

您正在使用的教程非常好。我可以向您推荐的是一个非常棒的,它可以帮助您轻松完成它,它使用 Google Play 服务和 Fences。我已经试过了,效果很好。

回答by Marcola Carr

The following tutorialis very good, easy to follow, has a lot sample code, and it's made by Google.

下面的教程很好,很容易上手,有很多示例代码,而且是谷歌制作的。

回答by Tiago

Tomtom has a Geofencing API with what you can easily create and edit fences that are stored in the Geofencing API service. It supports the following shape types:

Tomtom 有一个地理围栏 API,您可以轻松地创建和编辑存储在地理围栏 API 服务中的围栏。它支持以下形状类型:

  • circle
  • rectangle
  • corridor
  • polygon
  • 圆圈
  • 长方形
  • 走廊
  • 多边形

Also, you can search for POI (Points of Interest) or geometry (that is handled by the Search API service) and receive its shape boundaries.

此外,您可以搜索 POI(兴趣点)或几何图形(由搜索 API 服务处理)并接收其形状边界。

Link to the API here: https://developer.tomtom.com/products/geofencing-api

此处链接到 API:https: //developer.tomtom.com/products/geofencing-api