Realtime collaboration setup

You can setup realtime collaboration functionality using the collaboration package with the Apryse SDK.

Realtime collaboration setup for Xamarin.Android

This tutorial only applies to Xamarin.Android.

Prerequisites

  • Minimum API: 21
  • Java 8

To compile for Java 8, add the following to your application's .csproj file:

Visual Studio 2019 is required

sh

1<PropertyGroup>
2 <AndroidEnableDesugar>true</AndroidEnableDesugar>
3 <AndroidDexTool>d8</AndroidDexTool>
4</PropertyGroup>

Step 1: Integration

  1. Integrate Apryse core and the tools library as described in Xamarin get started guide.
  2. Open the NuGet package manager by right click on your project, and click Manage NuGet Packages.... Then in Browse tab, search for Apryse.

Insall:

Apryse Docs Image

Step 2: Add the viewer

  1. Update your AndroidManifest.xml as described in Step 1 of this guide.
  2. Create the CollabViewerTabHostFragment2, and start it like any other Android Fragment.

C#

1private void addViewerFragment(AppCompatActivity activity, Android.Net.Uri fileUri)
2{
3 // Create a custom ViewerConfig used to initialize the viewer fragment
4 var viewerConfig = new ViewerConfig.Builder()
5 .MultiTabEnabled(false)
6 .OpenUrlCachePath(this.CacheDir.AbsolutePath)
7 .Build();
8 // Create the Fragment using CollabViewerBuilder2
9 var tabHostFragment = (CollabViewerTabHostFragment2)CollabViewerBuilder2
10 .WithUri(fileUri)
11 .UsingConfig(viewerConfig)
12 .Build(this);
13 // Add the Fragment to your activity
14 var ft = activity.SupportFragmentManager.BeginTransaction();
15 ft.Replace(Resource.Id.fragment_container, tabHostFragment, null);
16 ft.Commit();
17}

where R.id.fragment_container is the resource id of a layout in your activity that will contain your fragment:

For example:

XML

1<?xml version="1.0" encoding="utf-8"?>
2<!-- This FrameLayout will contain our viewer fragment -->
3<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/fragment_container" android:layout_width="match_parent" android:layout_height="match_parent"/>

Next steps

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales