 
     func locationManager(manager: CLLocationManager!, didEnterRegion region: CLRegion!) {
         log("Entering region \(region.identifier)")
+        // send id to keystone service here
+        let isLoggedIn = NSUserDefaults.standardUserDefaults().boolForKey("isLoggedIn")
+        let serviceUrl = NSUserDefaults.standardUserDefaults().stringForKey("serviceUrl")
+        log("isLoggedIn:\(isLoggedIn)")
+        log("serviceUrl:\(serviceUrl)")
+        if isLoggedIn {
+            if let userId = NSUserDefaults.standardUserDefaults().stringForKey("userId") {
+                let lat = (region as CLCircularRegion).center.latitude
+                let lng = (region as CLCircularRegion).center.longitude
+                let radius = (region as CLCircularRegion).radius
+                
+                let strLat = NSNumber(double: lat).stringValue
+                let strLng = NSNumber(double: lng).stringValue
+                let strRadius = NSNumber(double: radius).stringValue
+                
+                log("strLat:\(strLat)")
+                log("strLng:\(strLng)")
+                log("strRadius:\(strRadius)")
+
+                var params = ["userId": userId, "storeId": region.identifier, "latitude":strLat, "longitude": strLng, "radius":strRadius] as Dictionary<String, String>
+                if(serviceUrl != nil) {
+                    post(params, url: serviceUrl!)
+                } else {
+                    log("serviceUrl not found in preference not updation checkin")
+                }
+            } else {
+                log("userId not found in preference not updation checkin")
+            }
+        }
         handleTransition(region)
     }
 

        notification.alertBody = geo["notification"]["text"].asString!
        UIApplication.sharedApplication().scheduleLocalNotification(notification)
    }
}

class GeoNotificationStore {

let iOS7 = floor(NSFoundationVersionNumber) <= floor(NSFoundationVersionNumber_iOS_7_1)

func log(message: String){
    #if DEBUG
        NSLog("%@ - %@", TAG, message)
    #endif
}

var GeofencePluginWebView: UIWebView?
