/// <summary>
        /// Handle when your app resumes.
        /// </summary>
        protected override void OnResume()
        {
            /// Set the value to label
            InfoLabelList[0].Text = "new GeofenceManager and VirtualPerimeter";
            try
            {
                if (geofence == null)
                {
                    // Create the GeofenceManager object
                    geofence = new GeofenceManager();
                    // Create the VirtualPerimeter object
                    perimeter = new VirtualPerimeter(geofence);
                }

                // Set the value to label
                InfoLabelList[1].Text = "Success";

                // Check the permission for location privilege
                if (PrivacyPrivilegeManager.CheckPermission("http://tizen.org/privilege/location") == CheckResult.Allow)
                {
                    // Add a handle for GeofenceEventChanged
                    geofence.GeofenceEventChanged += GeofenceEventChanged;
                    // Add a handle for StateChanged
                    geofence.StateChanged += StateChanged;
                    // Add a handle for ProximityChanged
                    geofence.ProximityChanged += ProximityChanged;
                }
            }
            catch (Exception e)
            {
                // Set the value to label about occured exception
                InfoLabelList[1].Text = e.Message;
            }
        }
        /// <summary>
        /// Handle when your app sleeps.
        /// </summary>
        protected override void OnSleep()
        {
            // Check the permission for location privilege
            if (PrivacyPrivilegeManager.CheckPermission("http://tizen.org/privilege/location") == CheckResult.Allow)
            {
                // Remove the handle for GeofenceEventChanged
                geofence.GeofenceEventChanged -= GeofenceEventChanged;
                // Remove the handle for StateChanged
                geofence.StateChanged -= StateChanged;
                // Remove the handle for ProximityChanged
                geofence.ProximityChanged -= ProximityChanged;
            }

            // Dispose the GeofenceManager object
            if (geofence != null)
            {
                geofence.Dispose();
            }

            perimeter = null;
            geofence  = null;

            // Set the value to the labels
            InfoLabelList[0].Text = "GeofenceManager.Dispose";
            InfoLabelList[1].Text = "Success";
        }
Beispiel #3
0
        public override Task StartMonitoring(GeofenceRegion region)
        {
            //geofence = new GeofenceManager();
            // Create the VirtualPerimeter object
            var perimeter = new VirtualPerimeter(this.geofences);

            throw new NotImplementedException();
        }