Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
jejemo committed Sep 4, 2024
0 parents commit 06e7413
Show file tree
Hide file tree
Showing 386 changed files with 27,322 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# OS X Files
.DS_Store
**/.DS_Store


# Gradle files
*/.gradle/
*.gradle/
# IDEA Files
local.properties
/.codecc/
/build.yml
*.iml
*.idea/
build/
/captures
.externalNativeBuild
.cxx

/tuicallkit/.idea/
/tuicallkit/build/
tuicore
52 changes: 52 additions & 0 deletions README-zh_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
_简体中文 | [English](README.md)_

# Call UIKit 示例工程快速跑通
<img src="https://qcloudimg.tencent-cloud.cn/raw/ec034fc6e4cf42cae579d32f5ab434a1.png" align="left" width=120 height=120>TUICallKit 是腾讯云推出一款音视频通话的含 UI 组件,通过集成该组件,您只需要编写几行代码就可以为您的 App 添加音视频通话功能,并且支持离线唤起能力。TUICallKit 支持 Android、iOS、Web、小程序、Flutter、UniApp 等多个开发平台。

<a href="https://apps.apple.com/cn/app/%E8%85%BE%E8%AE%AF%E4%BA%91%E8%A7%86%E7%AB%8B%E6%96%B9trtc/id1400663224"><img src="https://qcloudimg.tencent-cloud.cn/raw/afe9b8cc4c715346cf3d9feea8a65e33.svg" height=40></a> <a href="https://dldir1.qq.com/hudongzhibo/liteav/TRTCDemo.apk"><img src="https://qcloudimg.tencent-cloud.cn/raw/006d5ed3359640424955baa08dab7c7f.svg" height=40></a> <a href="https://web.sdk.qcloud.com/trtc/webrtc/demo/api-sample/login.html"><img src="https://qcloudimg.tencent-cloud.cn/raw/d326e70750f8bbad7245e229c5bd6d2b.svg" height=40></a>


## 环境准备
- Android 5.0 (SDK API level 21)及以上。
- Gradle 4.2.1 及以上。
- Mobile phone on Android 5.0 及以上。

## 运行示例

按照以下步骤,运行示例应用程序。

#### 创建应用

1. 登录到 [即时通信 IM 控制台](https://console.cloud.tencent.com/im),单击创建新应用,在弹出的对话框中输入您的应用名称,并单击确定。
2. 单击刚刚创建出的应用,进入**应用详情**页面,并在页面的右下角找到含 UI 低代码场景方案功能区,单击免费体验即可开通 TUICallKit 的 7 天免费试用服务。
3. 在同一页面找到 ***SDKAppID******密钥(SecretKey)*** 并保存,在后续步骤中使用。

#### 构建并运行应用程序
1. 下载代码
```
git clone https://github.com/tencentyun/TUICallKit.git
```
2. 配置 SDKAppID 和 SecretKey
`Android/debug/src/main/java/com/tencent/qcloud/tuikit/debug/GenerateTestUserSig.java` 文件中填写 SDKAppID 和 SecretKey。
```
public static final int SDKAPPID = SDKAppID;
private static final String SECRETKEY = SecretKey;
```
3. 在两台 Android 设备上运行并安装该程序。

## 实现音视频通话
1. 分别在两台设备上登录两个用户,一方作为主叫,一方作为被叫;
2. 在主叫方进入通话界面,输入被叫方的 ID,选择媒体类型,发起通话;
3. 被叫方收到通话的请求,点击接听后进行通话。

## 实现离线推送(可选)
TUICallKit 支持接入即时通信 IM 离线推送插件,详见:[Android离线推送](https://cloud.tencent.com/document/product/647/105230)

## 参考
- 如果您想了解更多产品功能,请点击[链接](https://cloud.tencent.com/document/product/647/78742)

- 如果您遇到困难,可以参考[常见问题](https://cloud.tencent.com/document/product/647/84363),这里有开发者最常遇到的问题,覆盖各个平台,希望可以帮助您快速解决问题。

- 完整的API文档请参见[音视频通话 SDK API 示例](https://cloud.tencent.com/document/product/647/78748):包括 TUICallKit(含UI)、TUICallEngine(不含UI)、以及通话回调事件等。

- 欢迎加入 QQ 群:**605115878**,进行技术交流和反馈~
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
English | [简体中文](README-zh_CN.md)

# Call UIKit for Android Quickstart

<img src="https://qcloudimg.tencent-cloud.cn/raw/ec034fc6e4cf42cae579d32f5ab434a1.png" align="left" width=120 height=120>TUICallKit is a UIKit about **audio&video calls** launched by Tencent Cloud. By integrating this component, you can write a few lines of code to use the video calling function, TUICallKit support offline calling and multiple platforms such as Android, iOS, Web, Flutter, etc.

<a href="https://apps.apple.com/cn/app/%E8%85%BE%E8%AE%AF%E4%BA%91%E8%A7%86%E7%AB%8B%E6%96%B9trtc/id1400663224"><img src="https://qcloudimg.tencent-cloud.cn/raw/afe9b8cc4c715346cf3d9feea8a65e33.svg" height=40></a> <a href="https://dldir1.qq.com/hudongzhibo/liteav/TRTCDemo.apk"><img src="https://qcloudimg.tencent-cloud.cn/raw/006d5ed3359640424955baa08dab7c7f.svg" height=40></a> <a href="https://web.sdk.qcloud.com/trtc/webrtc/demo/api-sample/login.html"><img src="https://qcloudimg.tencent-cloud.cn/raw/d326e70750f8bbad7245e229c5bd6d2b.svg" height=40></a>


## Before getting started

This section shows you the prerequisites you need for testing tuicallkit for Android sample app.

- Android 5.0 (SDK API level 21) or later.
- Gradle 4.2.1 or later.
- Mobile phone on Android 5.0 or later.

## Getting started

If you would like to run the sample app, you can do so by following the steps below.

#### Create application

1. Login or Sign-up for an account on [Tencent RTC Console](https://console.trtc.io/).
2. Create or select a calls-enabled application on the console.
3. Note your application ***SDKAppID*** and ***SDKSecretKey*** for future reference.

#### Build and run the sample app
1. Clone thie repository
```
git clone https://github.com/tencentyun/TUICallKit.git
```
2. Specify the SDKAppID and SDKSecretKey
Input the SDKAppID and SDKSecretKey into file `Android/debug/src/main/java/com/tencent/qcloud/tuikit/debug/GenerateTestUserSig.java`
```
public static final int SDKAPPID = SDKAppID;
private static final String SECRETKEY = SDKSecretKey;
```
3. Build and run the sample app on two Android devices.

## Making your first call

1. Log in to the sample app on the primary device with the user ID set as the `caller`.
2. Log in to the sample app on the secondary device using the ID of the user set as the `callee`.
3. On the primary device, specify the user ID of the `callee` and initiate a call.
4. If all steps are followed correctly, an incoming call invitation will appear on the device of the `callee`.

## Implementing Offline Push Notifications (Optional)
TUICallKit supports integrating with TIMPush plugin. For details, see: [Android Offline Push Notification](https://www.tencentcloud.com/document/product/647/50999)

## Reference
- If you want to learn more about the product features, you can click on the following [link](https://trtc.io/products/call).

- If you encounter difficulties, you can refer to [FAQs](https://trtc.io/document/53565), here are the most frequently encountered problems of developers, covering various platforms, I hope it can Help you solve problems quickly.

- For complete API documentation, see [Audio Video Call SDK API Example](https://trtc.io/document/51004): including TUICallKit (with UIKit), TUICallEngine (without UIKit), and call events Callbacks, etc.
55 changes: 55 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
apply plugin: 'com.android.application'

// delete it without offline push function
apply plugin: 'com.google.gms.google-services'

android {
compileSdkVersion 34
namespace "com.tencent.qcloud.tuikit.tuicallkit.demo"

defaultConfig {
applicationId "com.tencent.trtc"
versionName "1.0"
versionCode 1
minSdkVersion 19
targetSdkVersion 34
multiDexEnabled true
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a'
}
}

signingConfigs {
release {
storeFile file('tuicallkit.jks')
storePassword 'tencent'
keyAlias 'tuicallkit'
keyPassword 'tencent'
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
api project(":tuicallkit-kt")
api project(':debug')
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation 'androidx.multidex:multidex:2.0.1'

// Optional, if you use support library fragments:
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.12'

implementation 'com.tencent.timpush:timpush:latest.release'
implementation 'com.tencent.timpush:fcm:latest.release'
}
39 changes: 39 additions & 0 deletions app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"project_info": {
"project_number": "123456",
"project_id": "tencent-trtc",
"storage_bucket": "tencent-trtc.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "******",
"android_client_info": {
"package_name": "com.tencent.trtc"
}
},
"oauth_client": [
{
"client_id": "******.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "******"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "******.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
24 changes: 24 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

-keep class com.tencent.** { *; }
-keep class com.tencent.timpush.** { *; }
77 changes: 77 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<application
android:name="com.tencent.qcloud.tuikit.tuicallkit.demo.BaseApplication"
android:allowBackup="false"
android:icon="@drawable/app_ic_launcher"
android:label="@string/app_name"
android:roundIcon="@drawable/app_ic_launcher"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar"
tools:ignore="GoogleAppIndexingWarning">

<activity
android:name="com.tencent.qcloud.tuikit.tuicallkit.demo.MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/Theme.AppCompat.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>


<activity
android:name="com.tencent.qcloud.tuikit.tuicallkit.demo.LoginActivity"
android:theme="@style/Theme.AppCompat.NoActionBar" />

<activity
android:name="com.tencent.qcloud.tuikit.tuicallkit.demo.CallActivity"
android:exported="false"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="com.tencent.liteav.action.portal" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="com.tencent.qcloud"
android:path="/detail"
android:scheme="pushscheme" />
</intent-filter>
</activity>

<activity
android:name="com.tencent.qcloud.tuikit.tuicallkit.demo.ProfileActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />

<activity
android:name="com.tencent.qcloud.tuikit.tuicallkit.demo.GroupCallActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />

<activity
android:name="com.tencent.qcloud.tuikit.tuicallkit.demo.JoinInGroupCallActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />

<activity
android:name="com.tencent.qcloud.tuikit.tuicallkit.demo.setting.SettingsActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />

<activity
android:name="com.tencent.qcloud.tuikit.tuicallkit.demo.setting.SettingDetailActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
</application>

</manifest>
Binary file added app/src/main/assets/LiteavSegmentModel.zip
Binary file not shown.
6 changes: 6 additions & 0 deletions app/src/main/assets/timpush-configs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"com.tencent.trtc": {
"fcmPushBussinessId": ""
},
"version": "1.0.1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.tencent.qcloud.tuikit.tuicallkit.demo;

import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class BaseActivity extends AppCompatActivity {

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initStatusBar();
hideSoftKeyboard();
}

@Override
public boolean onTouchEvent(MotionEvent event) {
try {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
} catch (Exception e) {}
return super.onTouchEvent(event);
}

private void initStatusBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}

protected void hideSoftKeyboard() {
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
}
}
Loading

0 comments on commit 06e7413

Please sign in to comment.