我已经实现了geoFence api,一切都运行良好.但是有一些问题,我想对我的困惑做更多的澄清.
以下是一些混淆和问题:
我希望我的用户在进入地理围栏区域时收到通知.我按照指南实现了GeofenceTransitionsIntentService,但是当应用程序处于后台时它不会触发转换.我该怎么办?
GeoFence过期时间:很明显,如果我们进入Never,它不会过期,但我对时间感到困惑.例如,如果我将其设置为10分钟,那究竟是做什么的?地理围栏是否会在创建后的给定时间后到期,或者当用户到达该位置时会到期,然后计时器将启动?当用户到达那里时,我们如何让地理围栏过期.
Google如何跟踪我们?地理围栏实际上如何运作?我们没有发送我们的位置,那么它现在正在跟踪?当我们添加地理围栏然后在到达那个地方时通知我们,它是否开始跟踪我们?
请告诉我并讨论这些混淆,特别是关于它在应用程序关闭或销毁时工作的困惑.
我已经完成了许多SO职位,但是对我来说还没有任何工作。我试图在设备进入地理围栏时触发通知。但它不会触发,直到打开应用程序。当应用程序在背景中时如何触发通知?
地理围栏:
public class Geofencing implements ResultCallback {
// Constants
public static final String TAG = Geofencing.class.getSimpleName();
private static final float GEOFENCE_RADIUS = 50; // 50 meters
private static final long GEOFENCE_TIMEOUT = 24 * 60 * 60 * 1000; // 24 hours
private List<Geofence> mGeofenceList;
private PendingIntent mGeofencePendingIntent;
private GoogleApiClient mGoogleApiClient;
private Context mContext;
public Geofencing(Context context, GoogleApiClient client) {
mContext = context;
mGoogleApiClient = client;
mGeofencePendingIntent = null;
mGeofenceList = new ArrayList<>();
}
/***
* Registers the list …Run Code Online (Sandbox Code Playgroud)