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(); }); }
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(); }
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); } }); }