Sketchware Integration Guide

Back to Dashboard
PG_DevCallService
Sketchware

Implement in Sketchware

Learn how to add and use PG_DevCallService in your Sketchware or Sketchware Pro projects.

Blocks & Component JSON

Import these JSON files directly in Sketchware/Sketchware Pro to get pre-made blocks and component setup.

Note: Update these URLs to your actual file locations if different.

Introduction

This guide will help you integrate and use PG_DevCallService for calls inside Sketchware or Sketchware Pro. Follow the steps below for a smooth setup and reliable implementation.

Requirements & Important Notes

  • Latest version of Sketchware or Sketchware Pro recommended.
  • Working internet connection (required for API calls).
  • You must have an active API key from your dashboard.
  • Copy-paste code blocks carefully, and do not share your API key publicly.

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" />

Tip: Request runtime permissions for CAMERA and RECORD_AUDIO before starting a call. For Android 10+ storage use, prefer scoped storage; for Android 13+, ensure foreground service types are declared as above.

Step 1: Setup Library in Sketchware

  1. On your Sketchware/Sketchware Pro app, go to your project.
  2. Open the Library Manager and click “Import Library”.
  3. Paste/add the dependency code:
    // <Add library import instructions here>
    implementation 'com.pgdev:callservice:1.0.0'
  4. Sync/build your project.

Step 2: API Key Configuration

// Initialize the library (place in Set ID button click event)
String customId = "your-customID";
String apiKey = "your-apiKey";
call.init(customId, apiKey);

Step 3: Usage Example

// Start a call to a user ID
call.startCall("receiver-id");

Replace receiver-id with the actual target user ID.

Step-by-step tutorial (with pictures)

These screenshots show how to add and use the library in Sketchware/Sketchware Pro using blocks. Tap an image to view full size.

1) Library add/setup

Add library
Add the PG_DevCallService library to your Sketchware project.

2) onCreate: Initialization blocks

onCreate init
Place initialization blocks in onCreate and set API key.

3) On call end

On call end
Blocks to handle when a call ends.

4) On call received

On call received
Blocks to handle incoming call event.

5) On call start

On call start
Blocks to handle when a call is started.

6) Initialization/API key error reporting

Init errors
Report and debug errors from initialization or API key validation.

7) Get call duration as string / show toast

Call duration
Retrieve and display call duration text.

8) Video toggled callback

Video toggled
Perform actions when video is toggled during a call.

9) Audio toggled callback

Audio toggled
Perform actions when audio is toggled during a call.

10) Set custom ID and validate API key

Set ID & validate
Blocks for setting your custom ID and validating API key.

11) Call a friend/online user by ID

Place call by ID
Start a call to a specific user ID.

12) End ongoing call

End call
Block to end the current call.

13) Toggle audio (mute/unmute)

Toggle audio
Block to toggle microphone state.

14) Toggle video (off/on)

Toggle video
Block to toggle camera stream.

15) Switch camera (front/back)

Switch camera
Block to switch camera during an ongoing call.
Advanced UI blocks

16) Advanced UI: onCreate setup

Advanced UI onCreate
Place this block in onCreate to enable advanced UI state handling.

17) Advanced UI: video toggle button icon cycle

Video button icons
Set video off icon on first click, and video on icon on second click.

18) Advanced UI: audio toggle button icon cycle

Audio button icons
Set mute icon on first click, and unmute icon on second click.

19) Advanced UI: camera icon change

Camera icon change
Change camera-related icons based on state.

Troubleshooting

  • Error: "Invalid API key" – Check your API key and make sure it's active.
  • If you see network errors, ensure the device has internet access.
  • Refer to the general troubleshooting guide for more help.

Support & Feedback

Need more help? Contact our team at support@pgdevcallservice.com or join our community chat.