当我的标记从我的栅栏跳出时,如何处理Geofence.GEOFENCE_TRANSITION_EXIT

时间:2017-01-16 12:50:32

标签: java android

当我为地理围栏设置条件退出其工作正常但是在一段时间之后标记从围栏中跳出来告诉我如何处理标记的跳跃..

if (geofenceTransition == Geofence.GEOFENCE_TRANSITION_EXIT) {

            handler.postDelayed(new Runnable() {
                @Override
                public void run() {

                    int geofenceTransitions = geofencingEvent.getGeofenceTransition();

                    if (geofenceTransitions == Geofence.GEOFENCE_TRANSITION_EXIT) {
                        Log.d("EXIT", "You are exit");
                        Toast.makeText(GeoFenceTransitionIntentService.this, "u r exit", Toast.LENGTH_SHORT).show();
                        List<Geofence> triggerdGeoFencesList = geofencingEvent.getTriggeringGeofences();

                        //Getting the location that triggered the geofence transition.
                        String geofenceTransitionDetails = getGeofenceTransitionDetails(GeoFenceTransitionIntentService.this, geofenceTransitions, triggerdGeoFencesList);

                        sendNotification(geofenceTransitionDetails);
                        Log.d(TAG, geofenceTransitionDetails);
                        Date date = new Date(System.currentTimeMillis());
                        SimpleDateFormat format = new SimpleDateFormat("EEE, MMM d, ''yy , hh:mm:ss", Locale.ENGLISH);
                        String st_date = format.format(date);
                        Map<String, String> timestamp = ServerValue.TIMESTAMP;


                    } else if (geofenceTransitions == Geofence.GEOFENCE_TRANSITION_ENTER) {

                        Log.d("ENTER", "You are enter back in office");
                        Toast.makeText(GeoFenceTransitionIntentService.this, "\"You are enter back in office\"", Toast.LENGTH_SHORT).show();
                    }
                }
            }, 1000 * 1 * 60);

0 个答案:

没有答案