Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
themeRDark
git clone -b 1.1 git@githubhttps://github.com:/flashphoner/wcs-android-sdk-samples.git

2. Download the aar library and put it to the 'export' wcs-android-sdk-samples/export  folder

Example:

Code Block
languagebash
themeRDark
wget http://flashphoner.com/downloads/builds/flashphoner_client/wcs-android-sdk/1.1/wcs-android-sdk-1.1.0.x.aar
cp wcs-android-sdk-1.1.0.x.aar export

3. Open the 'export' wcs-android-sdk-samples/export folder and execute the export.sh  script that will prepare configs for further building. The result is placed into the 'output' wcs-android-sdk-samples/export/output folder.

Code Block
languagebash
themeRDark
cd export
./export.sh wcs-android-sdk-1.1.0.x.aar

...

4. Edit the local.properties file and specify paths to Android SDK and NDK

Example:

Code Block
languagebash
themeRDark
ndk.dir=/opt/android-ndk-r12b
sdk.dir=/opt/android-sdk-linux

...

Code Block
languagebash
themeRDark
cd output
gradle build

Since Android SDK build 1.1.0.55, it is necessary to use Gradle 7 and above, or build examples with Gradle wrapper

Code Block
languagebash
themeRDark
cd output
gradlew build

Also, JDK 11 should be installed.

Building examples in Android Studio

Prepare examples for building and put them to the 'output' folder, then rename it wcs-android-sdk-samples/export/output  folder to 'wcs_android_sdk_samples', for instance.

...

2. Open the project from the 'output' folder in Android Studio

43. Add Gradle run configuration to the Run / Debug Configurations menu

54. To configure the run, specify the build.gradle file, the name of the build and set the purpose to: build

65. Run building of examples.

...

The building result is .apk files located in the corresponding folders: 2players/build, click-to-call/build, and so on.
The Android SDK file is located in the following path in the project: libs/wcs-android-sdk-1.0.1.2.aar

Building a separate example

If you cannot run export script for all the examples, or wish to build a separate example, it can be prepared for building as follows:

1. Download examples source code

Code Block
languagebash
themeRDark
git clone -b 1.1 https://github.com/flashphoner/wcs-android-sdk-samples.git

2. Copy an example needed to a separate folder

Code Block
languagebash
themeRDark
cd wcs-android-sdk-samples
cp streaming-min gradle.properties ~/streaming-min

3. Download aar library and put it to libs subfolder in example folder

Code Block
languagebash
themeRDark
wget https://flashphoner.com/downloads/builds/flashphoner_client/wcs-android-sdk/1.1/wcs-android-sdk-1.1.0.x.aar
mkdir ~/streaming-min/libs
cp wcs-android-sdk-1.1.0.x.aar ~/streaming-min/libs

4. Add the buildscript section to the beginning of build.gradle file in example folder:

Code Block
themeRDark
buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven { url 'https://maven.google.com' }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.0'
        classpath 'com.github.triplet.gradle:play-publisher:1.1.5'
    }
}

5. Add the repositories section to the build.gradle file in example folder:

Code Block
themeRDark
repositories {
    jcenter()
    mavenCentral()
    maven { url 'https://maven.google.com' }
    google()
    flatDir{
        dirs 'libs'
    }
}

6. Replace the string in dependencies section of the build.gradle file in the example folder

Code Block
themeRDark
implementation project(':fp_wcs_api')

to

Code Block
themeRDark
implementation 'com.flashphoner.fpwcsapi:wcs-android-sdk-1.1.0.x@aar'

where wcs-android-sdk-1.1.0.x  is aar file name downloaded at step 3.

7. The build.gradle file example

Code Block
themeRDark
titlebuild.gradle
collapsetrue
apply plugin: 'com.android.application'
apply plugin: 'com.github.triplet.play'

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven { url 'https://maven.google.com' }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.0'
        classpath 'com.github.triplet.gradle:play-publisher:1.1.5'
    }
}

Properties signingProps = null

android {
    compileSdkVersion 31
    buildToolsVersion '31.0.0'
    defaultConfig {
        applicationId "com.flashphoner.wcsexample.two_way_streaming"
        minSdkVersion 26
        targetSdkVersion 31
        versionCode 2600001
        versionName "1.1"
    }
    def signingPropsFile = System.getenv('SIGNING_PROPERTIES')
    if (signingPropsFile && new File(signingPropsFile).exists()) {
        signingProps = new Properties()
        signingProps.load(new FileInputStream(file(signingPropsFile)))

        signingConfigs {
            release {
                storeFile file(signingProps['keystore'])
                storePassword signingProps['keystore.password']
                keyAlias signingProps['key.alias']
                keyPassword signingProps['key.password']
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

            if (signingProps) {
                signingConfig signingConfigs.release
            }
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

repositories {
    jcenter()
    mavenCentral()
    maven { url 'https://maven.google.com' }
    google()
    flatDir{
        dirs 'libs'
    }
}

dependencies {
    implementation 'com.flashphoner.fpwcsapi:wcs-android-sdk-1.1.0.x@aar'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    testImplementation 'junit:junit:4.12'
    implementation 'androidx.appcompat:appcompat:1.4.0'
    implementation 'com.google.android.material:material:1.4.0'
}

play {
    if(signingProps) {
        track = 'production'
        serviceAccountEmail = signingProps['service.account.email']
        pk12File = file(signingProps['service.account.pk12file'])
    }
}

8. Open the example folder in Android Studio to build the example. Android Studio will do Gradle sync and install gradle version needed

Image Added

9. To build the example with Gradle install Gradle wrapper and run

Code Block
languagebash
themeRDark
gradlew build

Known issues

1. It is impossible now to set microphone gain in Android SDK while publishing stream.