public class MainActivity : Activity { int tmpId = 0; protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); tmpId++; notify("OnCreate"); SetContentView (Resource.Layout.Main); } protected override void OnPause() { base.OnPause(); notify("OnPause"); tmpId++; } protected override void OnResume() { base.OnResume(); notify("OnResume"); tmpId++; } protected override void OnStop() { base.OnStop(); notify("OnStop"); tmpId++; } protected override void OnDestroy() { base.OnDestroy(); notify("OnDestroy"); tmpId++; } protected override void OnRestoreInstanceState(Bundle savedInstanceState) { base.OnRestoreInstanceState(savedInstanceState); notify("OnRestoreInstanceState"); tmpId++; } protected override void OnSaveInstanceState(Bundle outState) { base.OnSaveInstanceState(outState); notify("OnSaveInstanceState"); tmpId++; } private void notify(string methodName) { // Instantiate the builder and set notification elements: Notification.Builder builder = new Notification.Builder(this) .SetAutoCancel(true) .SetContentTitle("Informace o stavu aktivity") .SetContentText(methodName) .SetSmallIcon(Resource.Drawable.ic_notification); // Build the notification: Notification notification = builder.Build(); // Get the notification manager: NotificationManager notificationManager = GetSystemService(Context.NotificationService) as NotificationManager; // Publish the notification: int notificationId = tmpId; notificationManager.Notify(notificationId, notification); } }