RoomKit Flutter is a wrapper of Native Android and iOS RoomKit SDK

Overview

ZEGOCLOUD RoomKit Flutter

RoomKit Flutter is a wrapper of Native Android and iOS RoomKit SDK

Getting started

Prerequisites

Basic requirements

The platform-specific requirements are as follows:

To build an Android app:

  • Android SDK packages: Android SDK 30, Android SDK Platform-Tools 30.x.x or later.
  • An Android device or Simulator that is running on Android 4.1 or later and supports audio and video. We recommend you use a real device (Remember to enable USB debugging for the device).

To build an iOS app(NOT SUPPORT NOW!!!):

  • Xcode 7.0 or later
  • CocoaPods
  • An iOS device or Simulator that is running on iOS 13.0 or later and supports audio and video. We recommend you use a real device.

Check the development environment

After all the requirements required in the previous step are met, run the following command to check whether your development environment is ready:

$ flutter doctor

image

  • If the Android development environment is ready, the Android toolchain item shows a ready state.
  • If the iOS development environment is ready, the Xcode item shows a ready state.

Run the sample code

  1. Open the roomkit_flutter project in Android Studio.
  2. Make sure the developer mode and USB debugging are enabled for the Android device, and connect the Android device to your computer.
  3. If the Running Devices box in the upper area changes to the device name you are using, which means you are ready to run the sample code.
  4. Contact us to get the SecretID, SecretSign and ProductID. image
  5. Run flutter pub get on terminal
  6. Run the sample code on your device to experience the roomkit_flutter.

Integrate the SDK into your project

Turn off some classes's confusion

To prevent the ZEGO SDK public class names from being obfuscated, please complete the following steps:

  1. Create proguard-rules.pro file under [your_project > android > app] with content as show below:
-keep class **.zego.**  { *; }

image

  1. Add config code to android/app/build.gradle for release build:
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

image

Copy source code to your project

Copy roomkit_plugin.dart file to [your_project > lib] folder.

Copy RoomKitPlugin.kt file to where [MainActivity.kt] is located.

Copy libs folder to [your_project > android > app] folder.

Change code configuration

Add configureFlutterEngine method to MainActivity

when(call.method) { "init" -> { pluginHandler.init(call, result, application) } "joinRoom" -> { pluginHandler.joinRoom(call, result, this@MainActivity) } "getDeviceID" -> { pluginHandler.getDeviceID(call, result) } else -> { result.error("error_code", "error_message", null) } } } }">
...
import com.zegocloud.roomkit_flutter.RoomKitPlugin
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
...

class MainActivity: FlutterActivity() {
  ...

    override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
        super.configureFlutterEngine(flutterEngine)

        val pluginHandler = RoomKitPlugin()

        val messenger = flutterEngine.dartExecutor.binaryMessenger
        val channel = MethodChannel(messenger, "RoomKitPlugin")

        channel.setMethodCallHandler { call, result ->
            when(call.method) {
                "init" -> { pluginHandler.init(call, result, application) }
                "joinRoom" -> { pluginHandler.joinRoom(call, result, this@MainActivity) }
                "getDeviceID" -> { pluginHandler.getDeviceID(call, result) }
                else -> { result.error("error_code", "error_message", null) }
            }
        }
    }

Add config to [android > app > src > main > AndroidManifest.xml]

... ...">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" 
    ...
   <application
       tools:replace="android:label" 
       ...

image

Change minSdkVersion to 21 on [android > app > build.gradle]

    defaultConfig {
        ...
        minSdkVersion 21
        ...
    }

Add dependencies to [android > app > build.gradle]

dependencies {
    ...

    implementation "androidx.core:core-ktx:1.3.0"
    implementation 'com.squareup.okhttp3:okhttp:4.0.1'
    api fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
    api "com.google.android.material:material:1.1.0"
    api "com.google.code.gson:gson:2.8.6"
    api "com.tencent.imsdk:imsdk:5.1.56"
    api "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
    implementation "androidx.constraintlayout:constraintlayout:2.1.1"
}

Add config to [android > build.gradle]

buildscript {
    ...
    repositories {
        ...
        maven { url 'https://www.jitpack.io' } // Add this line
    }
...
}

allprojects {
    repositories {
        ...
        maven { url 'https://www.jitpack.io' } // Add this line
    }
}

Method call

The calling sequence of the SDK interface is as follows: init --> joinRoom

init

Before using the SDK function, you need to init the SDK first. We recommend init on application startup. The sample code is as follows:

class _MyHomePageState extends State<MyHomePage> {

  @override
  void initState() {
    RoomKitPlugin.init(widget.secretID).then((value) {
      print('SDK initialized');
    });
    super.initState();
  }

Join room

When you are ready to start a class, then you can call joinRoom to create or join in a class room.

TextButton(
    onPressed: () {
      getRoomKitToken().then((roomkitToken) {
        ZegoJoinRoomConfig config = ZegoJoinRoomConfig(
            _userID,
            _userName,
            roomkitToken,
            widget.productID,
            _roomID,
            _role);
        RoomKitPlugin.joinRoom(config, _subject).then((value) {
          print(value);
        });
      });
    },
    child: const Text('Join Room'))
You might also like...

Woocommerce SDK for Flutter. The Complete Woo Commerce SDK for Flutter.

Woocommerce SDK for Flutter. The Complete Woo Commerce SDK for Flutter.

woocommerce Woocommerce SDK for Flutter. Getting Started Add the package to your pubspec.yaml and import. import 'package:woocommerce/woocommerce.dart

Dec 6, 2022

A Flutter plugin for authenticating users by using the native TwitterKit SDKs on Android & iOS.

flutter_twitter_login A Flutter plugin for using the native TwitterKit SDKs on Android and iOS. This plugin uses the new Gradle 4.1 and Android Studio

Sep 15, 2022

Learn to make beautiful, native apps for Android & iOS

Learn to make beautiful, native apps for Android & iOS

name title subtitle description speaker flutter Flutter Learn to make beautiful, native apps for Android & iOS Flutter is a cross-platform, mobile dev

Nov 4, 2019

WooCommerce App template that uses Flutter. Integrated to work with WooCommerce stores, connect and create an IOS and Android app from Flutter for IOS and Android

WooCommerce App template that uses Flutter. Integrated to work with WooCommerce stores, connect and create an IOS and Android app from Flutter for IOS and Android

WooCommerce App: Label StoreMax Label StoreMax - v5.3.1 Official WooSignal WooCommerce App About Label StoreMax Label StoreMax is an App Template for

Jan 9, 2023

Android ve İOS gibi platformlar için mobil uygulama geliştirmenizi sağlayan bir SDK

Flutter Nedir? Google tarafından 2017 yılında piyasaya sürülmüş açık kaynak kodlu bir araçtır. Android ve İOS gibi platformlar için mobil uygulama gel

Mar 16, 2022

Native Drag and Drop for Flutter on iOS and MacOS

native_draggable A new flutter plugin project. Getting Started This project is a starting point for a Flutter plug-in package, a specialized package t

Dec 4, 2022

A plugin that brings native iOS keyboard behavior to Flutter.

iKeyboard A plugin that brings native iOS keyboard behavior to Flutter. Getting Started Just put IKeyboard as MaterialApp ancestor and put IKeyboard.b

May 4, 2022

A flutter plugin to get facebook deep links and log app events using the latest Facebook SDK to include support for iOS 14

Facebook Sdk For Flutter LinkedIn GitHub facebook_sdk_flutter allows you to fetch deep links, deferred deep links and log facebook app events. This wa

Dec 17, 2022

The @Flutter Plugin to show native toast on Android

The @Flutter Plugin to show native toast on Android

Native Toast The Flutter Plugin to show native toast on Android. How it works? The native_toast plugin works on the basis of the Toast class. in Andro

Jan 3, 2023
Owner
null
A wrapper around our Cocoa and Java client library SDKs, providing iOS and Android support for those using Flutter and Dart.

Ably Flutter Plugin A Flutter plugin wrapping the ably-cocoa (iOS) and ably-java (Android) client library SDKs for Ably, the platform that powers sync

Ably Realtime - our client library SDKs and libraries 46 Dec 13, 2022
A convenience wrapper for building Flutter apps with PDFTron mobile SDK.

About PDFTron Flutter PDFTron's Flutter PDF library brings smooth, flexible, and stand-alone document viewing and editing solutions using Flutter code

PDFTron Systems Inc. 157 Dec 26, 2022
A wrapper on top of MFMailComposeViewController from iOS and Mail Intent on android

flutter_mailer Share email content via device Email Client - supports multiple Attachments Simple & quick plugin for cross application data sharing of

Tal Jacobson 43 May 22, 2022
how to Integrating facebook audience network to flutter app for banner, interstitial, rewarded, native and native banner

fb_ads_flutter_12 A new Flutter project. Getting Started Watch the complite tutorial for integrating Facebook ads into the Flutter app in our Youtube

null 4 Nov 26, 2022
Flutter native ads - Show AdMob Native Ads use PlatformView

flutter_native_ads Flutter plugin for AdMob Native Ads. Compatible with Android and iOS using PlatformView. Android iOS Getting Started Android Androi

sakebook 64 Dec 20, 2022
react-native native module for In App Purchase.

Documentation Published in website. Announcement Version 8.0.0 is currently in release candidate. The module is completely rewritten with Kotlin and S

dooboolab 2.3k Dec 31, 2022
dna, dart native access. A lightweight dart to native super channel plugin

dna, dart native access. A lightweight dart to native super channel plugin, You can use it to invoke any native code directly in contextual and chained dart code.

Assuner 14 Jul 11, 2022
Easy-to-make native ads in flutter using AdMOB SDK.

native_admob_flutter Easy-to-make ads in Flutter with Google's AdMob SDK. English | Português Get started To get started with Native Ads for Flutter,

Bruno D'Luka 81 Dec 12, 2022
A native Dart SDK for Stripe.

stripe_fl stripe A native Dart SDK for Stripe. Documentation Initializing import 'package:stripe_fl/stripe_fl.dart'; Stripe.init( produc

Chiziaruhoma Ogbonda 3 May 15, 2020
This is a flutter based project. It authorize the user by scanning fingerprint using ios and android native fingerprint scanners.

flutter_fingerprint_auth Fingerprint Authentication in Flutter Introduction In this article we are talking about fingerprint authentication. As far as

Vnnovate Solutions Pvt Ltd 1 Aug 22, 2022