Integrate the SDK

Updated

Shows how to integrate the Server Gateway SDK and run the sample project.

This article shows how to create a simple Maven project, integrate the Server Gateway Java SDK, and run the app.

Set up the development environment

Make sure your server meets the following requirements.

Hardware environment

Operating system

  • Ubuntu 18.04 or higher
  • CentOS: 7.0 or higher

CPU architecture

  • arm64
  • x86-64

If you need to run the SDK on other architectures, submit a ticket to contact technical support.

Performance

  • CPU:8-core, 1.8 GHz or higher.
  • 2 GB of RAM or higher. 4 GB or higher is recommended.

Network

  • The server is connected to the internet and has an internet IP.
  • The server can access *.agora.io and *.agoralab.co.

Software environment

  • Apache Maven or other build tools. This page uses Apache Maven as an example.
  • JDK 8

Get an Agora App ID and a Video SDK Temporary Token

See Get Started with Agora to learn how to get an Agora App ID and a Video SDK temporary token.

Create a Maven project

See Maven in Five Minutes to create a Maven project.

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false

Integrate the SDK

  1. Navigate to the my-app folder.

    cd my-app
  2. Open pom.xml and replace the content with the following:

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    
    <groupId>org.example</groupId>
    <artifactId>agora-rtc-linux-java</artifactId>
    <version>1.0-SNAPSHOT</version>
    
    <dependencies>
        <dependency>
        <groupId>io.agora.rtc</groupId>
        <artifactId>linux-sdk</artifactId>
        <version>3.7.200.21</version>
        </dependency>
    </dependencies>
    
    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
    
    <build>
        <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.3</version>
            <configuration>
            <createDependencyReducedPom>true</createDependencyReducedPom>
            </configuration>
            <executions>
            <execution>
                <phase>package</phase>
                <goals>
                <goal>shade</goal>
                </goals>
                <configuration>
                <transformers>
                    <transformer
                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                    <mainClass>App</mainClass>
                    </transformer>
                </transformers>
                </configuration>
            </execution>
            </executions>
        </plugin>
        </plugins>
    </build>
    </project>

Refer to mvnrepository for other integration methods, such as Gradle.