Xamarin
Xamarin SDK

Installation

We recommend installing the Cobrowse.io SDK using NuGet. Add the following package to your Xamarin projects:
Xamarin.iOS
Xamarin.Android
Xamarin.Forms
To use Cobrowse.io in your Xamarin.iOS project, please add the following lines to your AppDelegate.cs:
1
using Xamarin.CobrowseIO;
2
3
[Register("AppDelegate")]
4
public class AppDelegate : UIResponder, IUIApplicationDelegate
5
{
6
[Export("application:didFinishLaunchingWithOptions:")]
7
public bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
8
{
9
CobrowseIO.Instance.License = "put your license key here";
10
CobrowseIO.Instance.Start();
11
12
return true;
13
}
14
}
Copied!
Important: Do this in your UIApplicationDelegate.FinishedLaunching implementation to make sure your device shows up in your dashboard right away.
Xamarin.iOS Swift support
Cobrowse.io SDK uses Swift language, and if you are targeting iOS 12.1 or earlier, it is required to add Xamarin.iOS.SwiftRuntimeSupport NuGet dependency to ship specific Swift dylibs used by Cobrowse with your application.
This NuGet copies the necessary Swift libraries in the right place when building your app or when generating the archive of the app (not the IPA).
This NuGet, however, does not copy the Swift libraries in the right place when generating the IPA using Visual Studio, causing the rejection of the App Store when uploading the IPA. Please follow Xamarin documentation describing how to build and publish your Xamarin.iOS application using the Xcode IPA wizard. The steps are:
    1.
    In Visual Studio, select a valid iOS device before archiving.
    2.
    Go to Build menu → Archive for Publishing
    3.
    Once done, open Xcode and go to WindowOrganizer
    4.
    Select the Archives tab
    5.
    On the left side of the window, select your app
    6.
    Click on Distribute App button and follow the wizard
To use Cobrowse.io in your Xamarin.Android project, please add the following lines to your Application subclass.
1
using Xamarin.CobrowseIO;
2
3
[Application]
4
public class MainApplication : Application
5
{
6
public override void OnCreate()
7
{
8
base.OnCreate();
9
10
CobrowseIO.Instance.License = "put your license key here";
11
CobrowseIO.Instance.Start(this);
12
}
13
}
Copied!
Important:
    Make sure you do this in your custom Application subclass OnCreate() to ensure devices register in your dashboard right away.
    Also make sure you are targeting Android 10 (API 29). In Visual Studio:
      Open the project settings
      Navigate to BuildGeneral
      In "Compile using Android version: (Target Framework)" drop-down list choose Android 10.0 (Q)
    The Cobrowse.io SDK uses AndroidX, so make sure you have migrated to AndroidX
You may also start CobrowseIO in your MainActivity or other Activity if necessary. In that case, the SDK will continue to function even as new Activities are being created and destroyed.
Alternatively, it is possible to access Cobrowse.io features from Xamarin.Forms projects. In this case you only need to initialize the Cobrowse.io SDK in your cross-platform project:
1
using Xamarin.CobrowseIO.Abstractions;
2
3
public partial class App : Xamarin.Forms.Application
4
{
5
public App()
6
{
7
InitializeComponent();
8
9
CobrowseIO.Instance.License = "put your license key here";
10
CobrowseIO.Instance.Start();
11
}
12
}
Copied!

Add your License Key

Please register an account and generate your free License Key at https://cobrowse.io/dashboard/settings.
This will associate sessions from your mobile app with your Cobrowse account.

Xamarin sample app

We provide a sample application showing how to use Cobrowse.io NuGet packages in Xamarin. Xamarin.Forms sample includes using 6-digit codes, full device screen sharing, and redacting sensitive data. Xamarin Classic sample is also available.

Try it out

Once you have your app running in the iOS Simulator or on a physical device, navigate to https://cobrowse.io/dashboard to see your device listed. You can click the "Connect" button to initiate a Cobrowse session!

Requirements

    iOS 9.0 or later
    Android API version 19 (4.4 KitKat) or later
Any questions at all? Please email us at [email protected].
Last modified 2mo ago