退出地理围栏时调用方法

Calling a method upon exiting Geofence

我想在用户离开地理围栏半径时调用一个方法,我不太确定该怎么做。看来我必须使用 GeofenceTransitionsIntentService(),但我发现的只是过时的代码

API 文档有一个完整的示例说明如何执行此操作。只需使用条件检查地理围栏服务的 onHandleIntent 中的 geofenceTransition == Geofence.GEOFENCE_TRANSITION_EXITdeveloper.android.com/training/location/geofencing.html