|
1 | 1 | # API Example Android |
2 | 2 |
|
3 | | -*English | [中文](README.zh.md)* |
| 3 | +_English | [中文](README.zh.md)_ |
4 | 4 |
|
5 | | -This project presents you a set of API examples to help you understand how to use Agora APIs. |
| 5 | +## Overview |
6 | 6 |
|
7 | | -## Prerequisites |
| 7 | +This repository contains sample projects using the Agora RTC Java SDK for Android. |
8 | 8 |
|
9 | | -- Android Studio 3.0+ |
10 | | -- Physical Android device |
11 | | -- Android simulator is supported |
| 9 | + |
12 | 10 |
|
13 | | -## Quick Start |
| 11 | +## Project structure |
14 | 12 |
|
15 | | -This section shows you how to prepare, build, and run the sample application. |
| 13 | +The project uses a single app to combine a variety of functionalities. Each function is loaded as a fragment for you to play with. |
16 | 14 |
|
17 | | -### Obtain an App Id |
| 15 | +| Function | Location | |
| 16 | +| ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | |
| 17 | +| Audio live streaming | [JoinChannelAudio.java](./app/src/main/java/io/agora/api/example/examples/basic/JoinChannelAudio.java) | |
| 18 | +| Video live streaming | [JoinChannelVideo.java](./app/src/main/java/io/agora/api/example/examples/basic/JoinChannelVideo.java) | |
| 19 | +| Custom audio capture | [CustomAudioSource.java](./app/src/main/java/io/agora/api/example/examples/advanced/customaudio/CustomAudioSource.java) | |
| 20 | +| Custom video renderer | [CustomRemoteVideoRender.java](./app/src/main/java/io/agora/api/example/examples/advanced/CustomRemoteVideoRender.java) | |
| 21 | +| Raw audio and video frames (JNI interface) | [ProcessRawData.java](./app/src/main/java/io/agora/api/example/examples/advanced/ProcessRawData.java) | |
| 22 | +| Raw audio frames (Native Java interface) | [ProcessAudioRawData.java](./app/src/main/java/io/agora/api/example/examples/advanced/ProcessAudioRawData.java) | |
| 23 | +| Custom video capture (Push) | [PushExternalVideo.java](./app/src/main/java/io/agora/api/example/examples/advanced/PushExternalVideo.java) | |
| 24 | +| Switch a channel | [VideoQuickSwitch.java](./app/src/main/java/io/agora/api/example/examples/advanced/VideoQuickSwitch.java) | |
| 25 | +| Join multiple channels | [JoinMultipleChannel.java](./app/src/main/java/io/agora/api/example/examples/advanced/JoinMultipleChannel.java) | |
| 26 | +| Set Audio profile | [SetAudioProfile.java](./app/src/main/java/io/agora/api/example/examples/advanced/SetAudioProfile.java) | |
| 27 | +| Set Video profile | [SetVideoProfile.java](./app/src/main/java/io/agora/api/example/examples/advanced/SetVideoProfile.java) | |
| 28 | +| Play audio files and audio mixing | [PlayAudioFiles.java](./app/src/main/java/io/agora/api/example/examples/advanced/PlayAudioFiles.java) | |
| 29 | +| Voice effects | [VoiceEffects.java](./app/src/main/java/io/agora/api/example/examples/advanced/VoiceEffects.java) | |
| 30 | +| MediaPlayer Kit | [MediaPlayerKit.java](./app/src/main/java/io/agora/api/example/examples/advanced/MediaPlayerKit.java) | |
| 31 | +| Geofencing | [GeoFencing.java](./app/src/main/java/io/agora/api/example/examples/advanced/GeoFencing.java) | |
| 32 | +| RTMP streaming | [RTMPStreaming.java](./app/src/main/java/io/agora/api/example/examples/advanced/RTMPStreaming.java) | |
| 33 | +| Audio/video stream custom encryption | [StreamEncrypt.java](./app/src/main/java/io/agora/api/example/examples/advanced/StreamEncrypt.java) | |
| 34 | +| Switch between custom video capture (MediaIO) and screen sharing | [SwitchExternalVideo.java](./app/src/main/java/io/agora/api/example/examples/advanced/SwitchExternalVideo.java) | |
| 35 | +| Video metadata | [VideoMetadata.java](./app/src/main/java/io/agora/api/example/examples/advanced/VideoMetadata.java) | |
| 36 | +| Report call status | [InCallReport.java](./app/src/main/java/io/agora/api/example/examples/advanced/InCallReport.java) | |
| 37 | +| Adjust volume | [AdjustVolume.java](./app/src/main/java/io/agora/api/example/examples/advanced/AdjustVolume.java) | |
| 38 | +| Pre-call test | [PreCallTest.java](./app/src/main/java/io/agora/api/example/examples/advanced/PreCallTest.java) | |
| 39 | +| Channel media relay | [HostAcrossChannel.java](./app/src/main/java/io/agora/api/example/examples/advanced/HostAcrossChannel.java) | |
| 40 | +| Super resolution | [SuperResolution.java](./app/src/main/java/io/agora/api/example/examples/advanced/SuperResolution.java) | |
| 41 | +| Audio/video stream encryption with methods provided by the SDK | [ChannelEncryption.java](./app/src/main/java/io/agora/api/example/examples/advanced/ChannelEncryption.java) | |
| 42 | +| Use multi-processing to send video streams from screen sharing and local camera | [MultiProcess.java](./app/src/main/java/io/agora/api/example/examples/advanced/MultiProcess.java) | |
| 43 | +| Switch role in live streaming | [LiveStreaming.java](./app/src/main/java/io/agora/api/example/examples/advanced/LiveStreaming.java) | |
| 44 | +| Use custom video source (mediaIO) to implement AR function | [ARCore.java](./app/src/main/java/io/agora/api/example/examples/advanced/ARCore.java) | |
| 45 | +| Send data stream | [SendDataStream.java](./app/src/main/java/io/agora/api/example/examples/advanced/SendDataStream.java) | |
18 | 46 |
|
19 | | -To build and run the sample application, get an App Id: |
| 47 | +## How to run the sample project |
20 | 48 |
|
21 | | -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. |
22 | | -2. Navigate in the Dashboard tree on the left to **Projects** > **Project List**. |
23 | | -3. Save the **App Id** from the Dashboard for later use. |
24 | | -4. Generate a temp **Access Token** (valid for 24 hours) from dashboard page with given channel name, save for later use. |
| 49 | +### Prerequisites |
25 | 50 |
|
26 | | -5. Open `Android/APIExample` and edit the `app/src/main/res/values/string_config.xml` file. Update `<#Your App Id#>` with your App Id, and change `<#Temp Access Token#>` with the temp Access Token generated from dashboard. Note you can leave the token variable `null` if your project has not turned on security token. |
| 51 | +- Physical Android device or Android simulator with Android 4.1+ |
| 52 | +- Android Studio (latest version recommended) |
27 | 53 |
|
28 | | - ``` |
29 | | - <string name="agora_app_id" translatable="false">YOUR APP ID</string> |
30 | | - // assign token to null if you have not enabled app certificate |
31 | | - <string name="agora_access_token" translatable="false">YOUR ACCESS TOKEN</string> |
32 | | - ``` |
| 54 | +### Steps to run |
33 | 55 |
|
34 | | -You are all set. Now connect your Android device and run the project. |
| 56 | +1. In Android Studio, open `/Android/APIExample`. |
| 57 | +2. Sync the project with Gradle files. |
| 58 | +3. Edit the `/Android/APIExample/app/src/main/res/values/string_config.xml` file. |
35 | 59 |
|
36 | | -> To ensure communication security, Agora uses tokens (dynamic keys) to authenticate users joining a channel. |
37 | | -> |
38 | | -> Temporary tokens are for demonstration and testing purposes only and remain valid for 24 hours. In a production environment, you need to deploy your own server for generating tokens. See [Generate a Token](https://docs.agora.io/en/Interactive Broadcast/token_server)for details. |
| 60 | + - Replace `YOUR APP ID` with your App ID. |
| 61 | + - Replace `YOUR ACCESS TOKEN` with the Access Token. |
39 | 62 |
|
40 | | -## Contact Us |
| 63 | + ```xml |
| 64 | + <string name="agora_app_id" translatable="false">YOUR APP ID</string> |
| 65 | + <string name="agora_access_token" translatable="false">YOUR ACCESS TOKEN</string> |
| 66 | + ``` |
41 | 67 |
|
42 | | -- For potential issues, take a look at our [FAQ](https://docs.agora.io/en/faq) first |
| 68 | + > See [Set up Authentication](https://docs.agora.io/en/Agora%20Platform/token) to learn how to get an App ID and access token. You can get a temporary access token to quickly try out this sample project. |
| 69 | + > |
| 70 | + > The Channel name you used to generate the token must be the same as the channel name you use to join a channel. |
| 71 | +
|
| 72 | + > To ensure communication security, Agora uses access tokens (dynamic keys) to authenticate users joining a channel. |
| 73 | + > |
| 74 | + > Temporary access tokens are for demonstration and testing purposes only and remain valid for 24 hours. In a production environment, you need to deploy your own server for generating access tokens. See [Generate a Token](https://docs.agora.io/en/Interactive%20Broadcast/token_server) for details. |
| 75 | +
|
| 76 | +4. Make the project and run the app in the simulator or connected physical Android device. |
| 77 | + |
| 78 | +You are all set! Feel free to play with this sample project and explore features of the Agora RTC SDK. |
| 79 | + |
| 80 | +## Feedback |
| 81 | + |
| 82 | +If you have any problems or suggestions regarding the sample projects, feel free to file an issue. |
| 83 | + |
| 84 | +## Reference |
| 85 | + |
| 86 | +- [RTC Java SDK Product Overview](https://docs.agora.io/en/Interactive%20Broadcast/product_live?platform=Android) |
| 87 | +- [RTC Java SDK API Reference](https://docs.agora.io/en/Interactive%20Broadcast/API%20Reference/java/index.html) |
| 88 | + |
| 89 | +## Related resources |
| 90 | + |
| 91 | +- Check our [FAQ](https://docs.agora.io/en/faq) to see if your issue has been recorded. |
43 | 92 | - Dive into [Agora SDK Samples](https://github.com/AgoraIO) to see more tutorials |
44 | 93 | - Take a look at [Agora Use Case](https://github.com/AgoraIO-usecase) for more complicated real use case |
45 | 94 | - Repositories managed by developer communities can be found at [Agora Community](https://github.com/AgoraIO-Community) |
46 | | -- You can find full API documentation at [Document Center](https://docs.agora.io/en/) |
47 | | -- If you encounter problems during integration, you can ask question in [Stack Overflow](https://stackoverflow.com/questions/tagged/agora.io) |
48 | | -- You can file bugs about this sample at [issue](https://github.com/AgoraIO/Basic-Video-Call/issues) |
| 95 | +- If you encounter problems during integration, feel free to ask questions in [Stack Overflow](https://stackoverflow.com/questions/tagged/agora.io) |
49 | 96 |
|
50 | 97 | ## License |
51 | 98 |
|
52 | | -The MIT License (MIT) |
| 99 | +The sample projects are under the MIT license. See the [LICENSE](/LICENSE) file for details. |
0 commit comments