Opt In and Opt Out Your Users
Turn recording on or off for a user at runtime in your Xamarin / MAUI app
Users are opted in by default when they install the app. Use these methods to stop or resume recording for a user at runtime, for example from a consent screen.
The examples use the UXCamDotNet 1.1.6 package. The methods are on the UXCam class in the Com.UXCam namespace.
Opt out a user
Stops and deletes the session in progress, if any, and stops recording future sessions on this device until you opt the user back in.
UXCam.OptOutOverall();The choice is saved on the device. It resets to opted in if the user reinstalls the app or clears its data.
Opt in a user
Turns recording back on for a user who was opted out. On Android, a new session starts right away if none is running.
UXCam.OptInOverall();Opt in status
Returns true if the user is opted in. It is a method on Android and a property on iOS.
#if ANDROID
bool optedIn = UXCam.OptInOverallStatus();
#elif IOS
bool optedIn = UXCam.OptInOverallStatus;
#endifVideo only
To keep analytics (screens, events, user properties) but stop recording video for a user:
UXCam.OptOutOfVideoRecordings(); // stop video, keep analytics
UXCam.OptIntoVideoRecordings(); // record video again
#if ANDROID
bool videoOn = UXCam.OptInVideoRecordingStatus();
#elif IOS
bool videoOn = UXCam.OptInVideoRecordingStatus;
#endifCall UXCam.OptIntoVideoRecordings() before starting UXCam, as in the installation guide, so iOS records video.
Version noteBefore 1.1.5, the Android methods were named
OptIntoVideoRecording()andOptOutOfVideoRecording(), and iOS had no video opt-in methods on this class.
Record only some users
To record only some users, for example a pilot group, start UXCam only for them instead of opting everyone else out. Users are opted in by default, so an opt-out that runs after UXCam starts can miss part of the first session.
if (isPilotUser)
{
UXCam.OptIntoVideoRecordings();
UXCam.Start(new UXCamConfiguration("YOUR_APP_KEY"));
}Updated about 2 hours ago
What's Next? ...
Turn recording on or off for a user at runtime in your Xamarin / MAUI app
