Xamarin
The Xamarin SDK has been deprecated and is no longer supported. This is due to Microsoft deprecating Xamarin support.
The Help Lightning Xamarin SDK is a C# SDK that allows Help Lightning calls to be embedded into your iOS or Android application.
Before you can use the SDK, you must have an API Key which requires a Help Lightning site with an Enterprise Tier.
You can download the iOS SDK from the following links:
The Help Lightning SDK is distributed as a NuGet package. Please set up a local repository and configure your environment to use the Help Lightning NuGet package.
To use the SDK, you will first need to implement the
ICallClientDelegate
interface. Make sure you set the delegate of the
CallClientFactory
.
using HelpLightning.SDK;
...
public partial class CallController : UIViewController, ICallClientDelegate
{
public override void ViewDidLoad()
{
...
// Set this instance as the default delegate.
CallClientFactory.Instance.CallClient.Delegate = this;
}
public void OnCallEnded(Call call, string reason)
{
Console.WriteLine("The call has ended: {0}", reason);
}
public void OnScreenCaptureCreated(Call call, object image)
{
// TODO: write or upload the image somewhere
}
public object isShareKnowledgeEnabled(Call call)
{
// Return true if you want to support Quick Knowledge Overlay
return false;
}
public object IsQuickKnowledgeOverlaySupported(Call call)
{
// Return true if you want to support Quick Knowledge Overlay
return false;
}
}
Then you need to create a Call
object. This should have all the
necessary tokens and URLs of the server to join. This information is
obtained by interacting with the server’s RESTful API to create a
call/session between users. Typically, this is handled by your
integration server.
Call call = new Call(sessionId, sessionToken, userToken,
url, apiKey, displayName, avatarurl);
// The second parameter should be a reference to a UIViewController
// where the Help Lightning SDK will embed the call
Task<IDictionary<string, object>> task = CallClientFactory.Instance.CallClient.StartCall(call, this);
task.ContinueWith(t => {
if (t.IsCompletedSuccessfully)
{
Console.WriteLine("The Call has started: " + t.Result[Call.HLCallInfoCallKey]);
}
else
{
Console.Error.WriteLine("Cannot start the call: " + t.Exception);
}
});
Starting with 16.4, on Android, you’ll also need to register the context:
namespace HelpLightning.SDK.Sample.Android
{
[Application]
public class SampleApplication : Application
{
public override void OnCreate()
{
base.OnCreate();
// The following line is required to initialize HL Android SDK in the Application.OnCreate()
HLClient.Instance.Init(ApplicationContext);
}
}
}
Help Lightning maintains a working example for both Android and iOS. Please read through the documentation in the top level of the repository as it is necessary run the sample integration server!
Here is a turtorial to add the screen sharing feature to an app, using Help Lightning Xamarin SDK: