using Xamarin.CobrowseIO;
[Register("AppDelegate")]
public class AppDelegate : UIResponder, IUIApplicationDelegate
[Export("application:didFinishLaunchingWithOptions:")]
public bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
CobrowseIO.Instance.SetDelegate(new CustomCobrowseDelegate());
// ... the rest of your app setup
public class CustomCobrowseDelegate : CobrowseIODelegate
// Sample end session UIView, constructor, and tap gesture recognizer implementation
private UIView _indicatorInstance;
public override void CobrowseShowSessionControls(Session session)
// You can render controls however you like here.
// One option is to add our sample end session UI defined below.
if (_indicatorInstance == null)
_indicatorInstance = GetDefaultSessionIndicator(container: UIApplication.SharedApplication.KeyWindow);
_indicatorInstance.Hidden = false;
public override void CobrowseHideSessionControls(Session session)
if (_indicatorInstance != null)
_indicatorInstance.Hidden = true;
private UIView GetDefaultSessionIndicator(UIView container)
var indicator = new UILabel();
indicator.BackgroundColor = new UIColor(red: 1.0f, green: 0.0f, blue: 0.0f, alpha: 0.7f);
indicator.Text = "End Session";
indicator.UserInteractionEnabled = true;
indicator.TextAlignment = UITextAlignment.Center;
indicator.Font.WithSize(UIFont.SmallSystemFontSize);
indicator.TextColor = UIColor.White;
indicator.Layer.CornerRadius = 10;
indicator.ClipsToBounds = true;
indicator.TranslatesAutoresizingMaskIntoConstraints = false;
container.AddSubview(indicator);
indicator.WidthAnchor.ConstraintEqualTo(200f).Active = true;
indicator.HeightAnchor.ConstraintEqualTo(40f).Active = true;
indicator.CenterXAnchor.ConstraintEqualTo(container.CenterXAnchor).Active = true;
indicator.BottomAnchor.ConstraintEqualTo(container.BottomAnchor, constant: -20f).Active = true;
var tapRecognizer = new UITapGestureRecognizer(() =>
CobrowseIO.Instance().CurrentSession?.End(null);
tapRecognizer.NumberOfTapsRequired = 1;
indicator.AddGestureRecognizer(tapRecognizer);
public override void SessionDidUpdate(Session session)
public override void SessionDidEnd(Session session)