Android Studio Integration Guide

Back to Dashboard

Introduction

This guide shows how to integrate PG_DevCallService in a native Android Studio project using Gradle. Follow the steps below to configure dependencies, set your API key, and start audio/video calls.

Requirements

  • Android Studio Giraffe or newer (Gradle 8+ recommended).
  • Min SDK as required by your app (recommend 21+).
  • Active API key from your PG_DevCallService dashboard.
  • Internet permission in AndroidManifest.xml.

Required Android permissions (AndroidManifest.xml)

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_ROUTING" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.REGISTER_CALL_PROVIDER" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
<uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />

Notes: On Android 10+ consider scoped storage alternatives to READ/WRITE_EXTERNAL_STORAGE. On Android 13+ declare specific foreground service types as above and request runtime permissions for CAMERA and RECORD_AUDIO before starting calls.

Gradle Setup

Add the repository and dependency to your project.

settings.gradle

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        // maven { url 'https://your-private-maven' } // if applicable
    }
}

app/build.gradle

dependencies {
    implementation 'com.pgdev:callservice:1.0.0'
}

API Key Configuration

Initialize the SDK with your API key. You can store it in local.properties or a secure runtime source.

// Kotlin
class App : Application() {
    override fun onCreate() {
        super.onCreate()
        val apiKey = BuildConfig.PG_DEV_API_KEY // or read from secure source
        CallService.init(this, apiKey)
    }
}
// Java
public class App extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        String apiKey = BuildConfig.PG_DEV_API_KEY; // or secure source
        CallService.init(this, apiKey);
    }
}

Usage Example

// Kotlin
CallService.startAudioCall("receiver_id")
CallService.startVideoCall("receiver_id")
// Java
CallService.startAudioCall("receiver_id");
CallService.startVideoCall("receiver_id");

Replace receiver_id with the actual user/peer ID.

Troubleshooting

  • 401 Unauthorized: Verify the API key and app initialization.
  • Check network access and device time settings for SSL issues.
  • See general troubleshooting guide.

Support & Feedback

Need help? Email support@pgdevcallservice.com or reach out via our community channels.