Some test text!

Search
Hamburger Icon

Xamarin / Guides / Setup (Android)

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

<PropertyGroup>
  <AndroidEnableDesugar>true</AndroidEnableDesugar>
  <AndroidDexTool>d8</AndroidDexTool>
</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:

NuGet for Collab

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.

    private void addViewerFragment(AppCompatActivity activity, Android.Net.Uri fileUri)
    {
        // Create a custom ViewerConfig used to initialize the viewer fragment
        var viewerConfig = new ViewerConfig.Builder()
            .MultiTabEnabled(false)
            .OpenUrlCachePath(this.CacheDir.AbsolutePath)
            .Build();
        // Create the Fragment using CollabViewerBuilder2
        var tabHostFragment = (CollabViewerTabHostFragment2)CollabViewerBuilder2
            .WithUri(fileUri)
            .UsingConfig(viewerConfig)
            .Build(this);
        // Add the Fragment to your activity
        var ft = activity.SupportFragmentManager.BeginTransaction();
        ft.Replace(Resource.Id.fragment_container, tabHostFragment, null);
        ft.Commit();
    }

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

For example:

<?xml version="1.0" encoding="utf-8"?>
<!-- This FrameLayout will contain our viewer fragment -->
<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

Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales