Пример #1
0
        public override void OnCreate()
        {
            base.OnCreate();
            Log.Info(TAG, "OnCreate: the service is initializing.");

            timestamper = new UtcTimestamper();
            handler     = new Handler();

            // This Action is only for demonstration purposes.
            runnable = new Action(() =>
            {
                OpenAtivity();
            });
        }
Пример #2
0
		public override void OnDestroy()
		{
			// We need to shut things down.
			Log.Debug(TAG, GetFormattedTimestamp());
			Log.Info(TAG, "OnDestroy: The started service is shutting down.");

			// Stop the handler.
			handler.RemoveCallbacks(runnable);

			// Remove the notification from the status bar.
			var notificationManager = (NotificationManager)GetSystemService(NotificationService);
			notificationManager.Cancel(NOTIFICATION_ID);

			timestamper = null;
			isStarted = false;
			base.OnDestroy();
		}
Пример #3
0
        public override void OnDestroy()
        {
            // We need to shut things down.
            Log.Debug(TAG, GetFormattedTimestamp());
            Log.Info(TAG, "OnDestroy: The started service is shutting down.");

            // Stop the handler.
            handler.RemoveCallbacks(runnable);

            // Remove the notification from the status bar.
            var notificationManager = (NotificationManager)GetSystemService(NotificationService);

            notificationManager.Cancel(NOTIFICATION_ID);

            timestamper = null;
            isStarted   = false;
            base.OnDestroy();
        }
Пример #4
0
        public override void OnCreate()
        {
            base.OnCreate();
            Log.Info(TAG, "OnCreate: the service is initializing.");

            timestamper = new UtcTimestamper();
            handler     = new Handler();

            // This Action is only for demonstration purposes.
            runnable = new Action(() =>
            {
                if (timestamper != null)
                {
                    Log.Debug(TAG, timestamper.GetFormattedTimestamp());
                    handler.PostDelayed(runnable, DELAY_BETWEEN_LOG_MESSAGES);
                }
            });
        }
Пример #5
0
		public override void OnCreate()
		{
			base.OnCreate();
			Log.Info(TAG, "OnCreate: the service is initializing.");

			timestamper = new UtcTimestamper();
			handler = new Handler();

			// This Action is only for demonstration purposes.
			runnable = new Action(() =>
							{
								if (timestamper != null)
								{
									Log.Debug(TAG, timestamper.GetFormattedTimestamp());
									handler.PostDelayed(runnable, DELAY_BETWEEN_LOG_MESSAGES);
								}
							});
		}