# Agora Android 1-to-1 Tutorial
This tutorial enables you to quickly get started in your development efforts to create an Android app with real-time video calls, voice calls, and interactive broadcasting. With this sample app you can:
* Join and leave a channel.
* Mute and unmute audio.
* Enable or disable video.
* Choose between the front or rear camera.
A more complete demonstration can be found [here](https://github.com/AgoraIO/OpenVideoCall-Android).
## Prerequisites
* Android Studio 2.0 or above.
* Android device (e.g. Nexus 5X). A real device is recommended because some simulators have missing functionality or lack the performance necessary to run the sample.
## Quick Start
This section shows you how to prepare, build, and run the sample application.
### Create an Account and Obtain an App ID
In order to build and run the sample application you must obtain an App ID:
1. Create a developer account at [agora.io](https://dashboard.agora.io/signin/). Once you finish the signup process, you will be redirected to the Dashboard.
2. Navigate in the Dashboard tree on the left to **Projects** > **Project List**.
3. Locate the file **app/src/main/res/values/strings.xml** and replace <#YOUR APP ID#> with the App ID in the dashboard.
```xml
<string name="agora_app_id"><#YOUR APP ID#></string>
```
### Integrate the Agora Video SDK into the sample project
The SDK must be integrated into the sample project before it can opened and built. There are two methods for integrating the Agora Video SDK into the sample project. The first method uses JCenter to automatically integrate the SDK files. The second method requires you to manually copy the SDK files to the project.
#### Method 1 - Integrate the SDK Automatically Using JCenter (Recommended)
1. Clone this repository.
2. Open **app/build.gradle** and add the following line to the `dependencies` list:
```
...
dependencies {
...
compile 'io.agora.rtc:full-sdk:2.2.3'
}
```
#### Method 2 - Manually copy the SDK files
1. Clone this repository.
2. Download the Agora Video SDK from [Agora.io SDK](https://www.agora.io/en/download/).
3. Unzip the downloaded SDK package.
4. Copy the .jar file from the **libs** folder of the downloaded SDK package to the **/apps/libs** folder of the sample application.
5. Copy the .so files from the **armeabi-v7a** folder of the downloaded SDK package to the **/app/src/main/jniLibs/armeabi-v7a** folder of the sample application.
6. *(Optional)* Copy the .so files from the **arm64-v8a** folder of the downloaded SDK package to the **/app/src/main/jniLibs/arm64-v8a** folder of the sample application.
7. *(Optional)* Copy the .so files from the **x86** folder of the downloaded SDK package to the **/app/src/main/jniLibs/x86** folder of the sample application.
### Obtain and Build the Sample Application
1. Open the sample application in Android Studio.
2. Build and run the sample project. This should display the application on your device.
## Steps to Create the Sample
* [Set Permission](#set-permissions)
* [Create Visual Assets](#create-visual-assets)
* [Design the User Interface](#design-the-user-interface)
For details about the APIs used to develop this sample, see the [Agora.io Documentation version 2.2](https://docs.agora.io/en/2.2).
## Set Permissions
In the `AndroidManifest.xml` file, `uses-permissions` settings were added for the Internet, audio recording, audio settings, network state, camera, and Bluetooth to allow the app to access these features:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.agora.tutorials1v1vcall">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".VideoChatViewActivity"
android:screenOrientation="sensorPortrait"
android:theme="@style/FullScreenVideoTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
```
### Create Visual Assets
Add the following icon assets for the user interface to the */res/drawable* folder:
|Asset |Description |
|------------------------|---------------------------------------------------------------------------------------------------|
|`btn_end_call.png`|An image of a red telephone for a *hang up* button.|
|`btn_mute.png`|An image of a microphone to mute audio.|
|`btn_switch_camera.png`|An image of a camera and rotational arrows to switch between the two cameras.|
|`btn_video.png`|An image of a camera to start video.|
|`btn_voice.png`|An image of an arrow indicating that audio chat is enabled.|
|`ic_launcher.png`|A desktop icon for users to invoke the sample application.|
### Design the User Interface
The sample contains a single activity called *VideoChatViewActivity* and its layout is defined in */layout/activity_video_chat_view.xml*.
The main aspects of this layout are shown here:
![ActivityViewChat.png](/images/ActivityViewChat.png)
|Component |Description |
|---------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
|`activity_video_chat_view` |A view that handles the main video feed. This view contains other views.|
|`remote_video_view_container` |A view displaying the remote, incoming video feed (for example, the video the user will see).|
|`local_video_view_container` |A smaller view at the top right corner showing the local video feed.|
|`quick_tips_when_use_agora_sdk` |Displays quick tip information.|
|`LinearLayout (unamed)` |A layout that encapsulates four buttons: **Pause Video**, **Audio Mute**, **Switch Camera**, and **Hang Up**. Each button uses the assets described above.|
## Configure Resources
To configure 1-to-1 communication resources:
* [Create an Agora Instance](#create-an-agora-instance)
* [Configure the Video Mode](#configure-video-mode)
* [Set up Local Video](#set-up-local-video)
* [Join a Channel](#join-a-channel)
* [Set up Video Chat View Activity](#set-up-video-chat-view-activity)
### Create an Agora Instance
The code samples in this section are in *ViewChatViewActivity.java*.
The following imports define the interface of the Agora API that provides communication functionality:
- `io.agora.rtc.Constants`
- `io.agora.rtc.IRtcEngineEventHandler`
- `io.agora.rtc.RtcEngine`
- `io.agora.rtc.video.VideoCanvas`
Create a singleton by invoking [RtcEngine.create()](https://docs.agora.io/en/2.2/product/Interactive%20Gaming/API%20Reference/game_android?platform=Android) during initialization, passing the application ID stored in *strings.xml* and a reference to the activity's event handler. The Agora API uses events to inform the application about Agora engine runtime events, such as joining or leaving a channel and adding new participants.
```java
import io.agora.rtc.Constants;
import io.agora.rtc.IRtcEngineEventHandler;
import io.ago
没有合适的资源?快使用搜索试试~ 我知道了~
1对1社交原生交友系统源码 带同城直播【双端APP】
共1159个文件
flat:494个
dex:138个
class:136个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 8 下载量 99 浏览量
2022-07-12
14:57:33
上传
评论 4
收藏 70.37MB RAR 举报
温馨提示
资源推荐
资源详情
资源评论
收起资源包目录
1对1社交原生交友系统源码 带同城直播【双端APP】 (1159个子文件)
0N0F7Za9GGLQMtIka9sAS7kmqgA= 657KB
0N0F7Za9GGLQMtIka9sAS7kmqgA= 657KB
1xsKiwfjjXkW_qv052BdNBcHib8= 93KB
1xsKiwfjjXkW_qv052BdNBcHib8= 93KB
4Rc+7SRXXytSpILlyh7degnNf_U= 24KB
4Rc+7SRXXytSpILlyh7degnNf_U= 24KB
._app 212B
._arm64-v8a 212B
._armeabi-v7a 212B
._bogo_live 212B
._drawable-xxxhdpi 212B
._gradle 212B
._gradlew 212B
._images 212B
._java 212B
._jniLibs 212B
._layout 212B
._libs 212B
._main 212B
._PLACEHOLDER 212B
._PLACEHOLDER 212B
._PLACEHOLDER 212B
._PLACEHOLDER 212B
._res 212B
._src 212B
._values 212B
._wrapper 212B
._x86 212B
resources-debug.ap_ 388KB
app-debug.apk 19.32MB
gradlew.bat 2KB
._gradlew.bat 212B
taskHistory.bin 885KB
classAnalysis.bin 826KB
jarAnalysis.bin 358KB
fileHashes.bin 155KB
taskHistory.bin 108KB
taskJars.bin 20KB
outputFiles.bin 20KB
resourceHashesCache.bin 19KB
last-build.bin 1B
R$styleable.class 24KB
R$styleable.class 24KB
R$style.class 22KB
R$style.class 22KB
R$attr.class 11KB
R$attr.class 11KB
VideoChatViewActivity.class 9KB
VideoChatViewActivity.class 9KB
R$dimen.class 7KB
R$dimen.class 6KB
R$drawable.class 6KB
R$drawable.class 5KB
R$color.class 5KB
R$id.class 5KB
R$color.class 5KB
R$id.class 4KB
R$layout.class 3KB
R$layout.class 3KB
R$string.class 2KB
R$string.class 2KB
R$dimen.class 2KB
VideoChatViewActivity$1.class 2KB
R$dimen.class 2KB
R$dimen.class 1KB
R$dimen.class 1KB
R$dimen.class 1KB
R$dimen.class 1KB
R$dimen.class 1KB
R$dimen.class 1KB
VideoChatViewActivity$1.class 1KB
R$id.class 1KB
R$id.class 1KB
R$id.class 1KB
R$id.class 1KB
R$layout.class 1KB
R$id.class 1KB
R$id.class 1KB
R$id.class 1KB
R$id.class 1KB
R$layout.class 1KB
R$style.class 1KB
R$style.class 1KB
R.class 1KB
R$styleable.class 1KB
R$styleable.class 1KB
R$styleable.class 1KB
R$styleable.class 1KB
R$styleable.class 1KB
R$styleable.class 1KB
R$styleable.class 1KB
R$styleable.class 1KB
VideoChatViewActivity$1$3.class 1KB
R$drawable.class 1KB
VideoChatViewActivity$2.class 1KB
R.class 1024B
VideoChatViewActivity$1$1.class 1022B
R$drawable.class 1017B
R.class 1015B
R$drawable.class 999B
共 1159 条
- 1
- 2
- 3
- 4
- 5
- 6
- 12
软希源码
- 粉丝: 4002
- 资源: 3532
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 论文(最终)_20240430235101.pdf
- 基于python编写的Keras深度学习框架开发,利用卷积神经网络CNN,快速识别图片并进行分类
- 最全空间计量实证方法(空间杜宾模型和检验以及结果解释文档).txt
- 5uonly.apk
- 蓝桥杯Python组的历年真题
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 前端开发技术实验报告:内含4四实验&实验报告
- Highlight Plus v20.0.1
- 林周瑜-论文.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页