Esempio n. 1
0
 public async Task <bool> Exists(string userId, GeofenceRequest gfr)
 {
     return(await digitServiceContext.FocusItems
            .Include(v => v.Geofences)
            .Where(v => v.UserId == userId)
            .SelectMany(v => v.Geofences)
            .Where(v => v.Id == gfr.Id &&
                   v.Start == gfr.Start.UtcDateTime &&
                   v.Exit == gfr.Exit &&
                   v.FocusItemId == gfr.FocusItemId &&
                   Math.Abs(v.Lat - gfr.Lat) < 0.01 &&
                   Math.Abs(v.Lng - gfr.Lng) < 0.01 &&
                   v.Radius == gfr.Radius)
            .AnyAsync());
 }
Esempio n. 2
0
        public void CreateGeo()
        {
            Geofence fence = geoBuild
                             .setUniqueId("7")
                             .setRoundArea(LocationCallBackWrap.latitude, LocationCallBackWrap.longitude, 200)
                             .setConversions(7)
                             .setValidContinueTime(1000000)
                             .setDwellDelayTime(10000)
                             .setNotificationInterval(100)
                             .build();
            List geofenceList = new List();
            bool r            = geofenceList.add(fence.obj);

            GeofenceRequest.Builder builder = new GeofenceRequest.Builder();
            builder.createGeofenceList(geofenceList);
            builder.setInitConversions(7);
            GeofenceRequest request = builder.build();

            mService      = new GeofenceService(new Context());
            pendingIntent = getPendingIntent();
            mService.createGeofenceList(request, pendingIntent).addOnCompleteListener(new MCompleteListener());
        }