Skip to content

Commit 9b125cd

Browse files
authored
Merge pull request #450 from AgoraIO/dev/4.5.2
Dev/4.5.2
2 parents 3414516 + deef6ba commit 9b125cd

File tree

90 files changed

+1734
-933
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+1734
-933
lines changed

.github/ci/build/build_android.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ echo pwd: `pwd`
5151
echo sdk_url: $sdk_url
5252
unzip_name=Agora_Native_SDK_for_Android_FULL_DEFAULT
5353
zip_name=Agora_Native_SDK_for_Android_FULL_DEFAULT.zip
54-
if [ -z "$sdk_url" ]; then
54+
if [ -z "$sdk_url" ] || [ "$sdk_url" = "none" ]; then
5555
echo "sdk_url is empty"
5656
echo unzip_name: $unzip_name
5757
echo zip_name: $zip_name
@@ -85,12 +85,11 @@ if [ $compile_project = true ]; then
8585
export ANDROID_HOME=/usr/lib/android_sdk
8686
echo ANDROID_HOME: $ANDROID_HOME
8787
cd ./$unzip_name/rtc/samples/API-Example || exit 1
88-
if [ -z "$sdk_url" ]; then
88+
if [ -z "$sdk_url" ] || [ "$sdk_url" = "none" ]; then
8989
./cloud_build.sh false || exit 1
9090
else
9191
./cloud_build.sh true || exit 1
9292
fi
93-
9493
fi
9594

9695

Android/APIExample-Audio/app/build.gradle

+19-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apply plugin: 'com.android.application'
2-
2+
apply plugin: 'org.jetbrains.kotlin.android'
33

44
def sdkVersionFile = file("../gradle.properties")
55
def properties = new Properties()
@@ -11,13 +11,13 @@ println("${rootProject.project.name} agoraSdkVersion: ${agoraSdkVersion}")
1111
def localSdkPath= "${rootProject.projectDir.absolutePath}/../../sdk"
1212

1313
android {
14-
compileSdkVersion 32
15-
buildToolsVersion "32.0.0"
14+
namespace "io.agora.api.example"
15+
compileSdk 35
1616

1717
defaultConfig {
1818
applicationId "io.agora.api.example.audio"
19-
minSdkVersion 21
20-
targetSdkVersion 32
19+
minSdkVersion 24
20+
targetSdkVersion 35
2121
versionCode 1
2222
versionName "1.0"
2323

@@ -50,11 +50,12 @@ android {
5050
}
5151

5252
compileOptions {
53-
sourceCompatibility JavaVersion.VERSION_1_8
54-
targetCompatibility JavaVersion.VERSION_1_8
53+
sourceCompatibility JavaVersion.VERSION_17
54+
targetCompatibility JavaVersion.VERSION_17
55+
}
56+
kotlinOptions {
57+
jvmTarget = "17"
5558
}
56-
57-
5859

5960
sourceSets {
6061
main {
@@ -67,6 +68,7 @@ android {
6768

6869
buildFeatures{
6970
viewBinding true
71+
buildConfig true
7072
}
7173

7274
applicationVariants.all {
@@ -96,18 +98,19 @@ dependencies {
9698
// implementation "io.agora.rtc:drm:${agoraSdkVersion}"
9799
}
98100

99-
implementation 'androidx.appcompat:appcompat:1.5.0'
101+
implementation 'androidx.appcompat:appcompat:1.7.0'
100102
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
103+
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.8.22"
101104

102105
// Java language implementation
103-
implementation "androidx.navigation:navigation-fragment:2.5.0"
104-
implementation "androidx.navigation:navigation-ui:2.5.0"
106+
implementation "androidx.navigation:navigation-fragment:2.7.0"
107+
implementation "androidx.navigation:navigation-ui:2.7.0"
105108

106109
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
107-
implementation 'androidx.recyclerview:recyclerview:1.2.1'
108-
testImplementation 'junit:junit:4.12'
109-
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
110-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
110+
implementation 'androidx.recyclerview:recyclerview:1.3.2'
111+
testImplementation 'junit:junit:4.13.2'
112+
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
113+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
111114

112115
implementation 'io.github.luizgrp.sectionedrecyclerviewadapter:sectionedrecyclerviewadapter:1.2.0'
113116
implementation 'de.javagl:obj:0.2.1'

Android/APIExample-Audio/app/proguard-rules.pro

+8-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,11 @@
2222

2323
-keep class io.agora.**{*;}
2424
-dontwarn javax.**
25-
-dontwarn com.google.devtools.build.android.**
25+
-dontwarn com.google.devtools.build.android.**
26+
27+
# OkHttp
28+
-dontwarn org.bouncycastle.jsse.**
29+
-dontwarn org.conscrypt.**
30+
-dontwarn org.openjsse.**
31+
-dontwarn okhttp3.internal.platform.**
32+
-dontwarn org.codehaus.mojo.animal_sniffer.**

Android/APIExample-Audio/app/src/main/AndroidManifest.xml

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="io.agora.api.example">
3+
xmlns:tools="http://schemas.android.com/tools">
44

55
<uses-permission android:name="android.permission.INTERNET" />
66
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
7-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
87
<uses-permission android:name="android.permission.RECORD_AUDIO" />
98
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
109
<uses-permission android:name="android.permission.BLUETOOTH"/>
1110
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
1211
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
1312

14-
<permission-group android:name="io.agora.api.example.audio.andpermission"/>
15-
13+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
1614
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
17-
<!-- <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />-->
15+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
1816

1917
<application
2018
android:name=".MainApplication"

Android/APIExample-Audio/app/src/main/java/io/agora/api/example/examples/basic/JoinChannelAudio.java

+39-25
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import android.content.pm.ServiceInfo;
1414
import android.graphics.Bitmap;
1515
import android.graphics.BitmapFactory;
16+
import android.graphics.Color;
17+
import android.graphics.drawable.Icon;
1618
import android.os.Build;
1719
import android.os.Bundle;
1820
import android.os.Handler;
@@ -322,11 +324,14 @@ public void onPause() {
322324

323325
private void startRecordingService() {
324326
if (joined) {
325-
Intent intent = new Intent(requireContext(), LocalRecordingService.class);
326-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
327-
requireContext().startForegroundService(intent);
328-
} else {
329-
requireContext().startService(intent);
327+
Context context = getContext();
328+
if (context != null) {
329+
Intent intent = new Intent(context, LocalRecordingService.class);
330+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
331+
context.startForegroundService(intent);
332+
} else {
333+
context.startService(intent);
334+
}
330335
}
331336
}
332337
}
@@ -347,8 +352,11 @@ public void onResume() {
347352
}
348353

349354
private void stopRecordingService() {
350-
Intent intent = new Intent(requireContext(), LocalRecordingService.class);
351-
requireContext().stopService(intent);
355+
Context context = getContext();
356+
if (context != null) {
357+
Intent intent = new Intent(context, LocalRecordingService.class);
358+
requireContext().stopService(intent);
359+
}
352360
}
353361

354362
@Override
@@ -665,8 +673,8 @@ public void onAudioRouteChanged(int routing) {
665673
* And the android:foregroundServiceType should be microphone.
666674
*/
667675
public static class LocalRecordingService extends Service {
668-
private static final int NOTIFICATION_ID = 1234567800;
669-
private static final String CHANNEL_ID = "audio_channel_id";
676+
private static final int NOTIFICATION_ID = 1234567900;
677+
private static final String CHANNEL_ID = "api_audio_channel_id";
670678

671679

672680
@Override
@@ -707,32 +715,38 @@ private Notification getDefaultNotification() {
707715
icon = R.mipmap.ic_launcher;
708716
}
709717

710-
if (Build.VERSION.SDK_INT >= 26) {
718+
Intent intent = new Intent(this, MainActivity.class);
719+
intent.setAction("io.agora.api.example.ACTION_NOTIFICATION_CLICK");
720+
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
721+
int requestCode = (int) System.currentTimeMillis();
722+
723+
PendingIntent activityPendingIntent = PendingIntent.getActivity(
724+
this, requestCode, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE
725+
);
726+
727+
Notification.Builder builder;
728+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
711729
NotificationChannel mChannel = new NotificationChannel(CHANNEL_ID, name, NotificationManager.IMPORTANCE_DEFAULT);
712730
NotificationManager mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
713731
mNotificationManager.createNotificationChannel(mChannel);
714-
}
715-
716-
PendingIntent activityPendingIntent;
717-
Intent intent = new Intent();
718-
intent.setClass(this, MainActivity.class);
719-
if (Build.VERSION.SDK_INT >= 23) {
720-
activityPendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE);
732+
builder = new Notification.Builder(this, CHANNEL_ID);
721733
} else {
722-
activityPendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
734+
builder = new Notification.Builder(this);
723735
}
724736

725-
Notification.Builder builder = new Notification.Builder(this)
726-
.addAction(icon, "Back to app", activityPendingIntent)
727-
.setContentText("Agora Recording ...")
737+
builder.setContentTitle("Agora Recording ...")
738+
.setContentText("Tap here to return to the app.")
739+
.setContentIntent(activityPendingIntent)
740+
.setAutoCancel(true)
728741
.setOngoing(true)
729742
.setPriority(Notification.PRIORITY_HIGH)
730743
.setSmallIcon(icon)
731-
.setTicker(name)
744+
.setVisibility(Notification.VISIBILITY_PUBLIC)
732745
.setWhen(System.currentTimeMillis());
733-
if (Build.VERSION.SDK_INT >= 26) {
734-
builder.setChannelId(CHANNEL_ID);
735-
}
746+
747+
Icon iconObj = Icon.createWithResource(this, icon);
748+
Notification.Action action = new Notification.Action.Builder(iconObj, "Return to the app", activityPendingIntent).build();
749+
builder.addAction(action);
736750

737751
return builder.build();
738752
}

Android/APIExample-Audio/app/src/main/java/io/agora/api/example/utils/ClassUtils.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.util.regex.Pattern;
2222

2323
import dalvik.system.DexFile;
24-
import io.agora.api.example.BuildConfig;
2524

2625
public class ClassUtils
2726
{
@@ -160,7 +159,7 @@ public static List<String> getSourcePaths(Context context) throws PackageManager
160159
}
161160
}
162161

163-
if (BuildConfig.DEBUG)
162+
if (io.agora.api.example.BuildConfig.DEBUG)
164163
{ // Search instant run support only debuggable
165164
sourcePaths.addAll(tryLoadInstantRunDexFile(applicationInfo));
166165
}

Android/APIExample-Audio/app/src/main/java/io/agora/api/example/utils/PermissonUtils.java

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ public class PermissonUtils {
1515

1616
public static String[] getCommonPermission() {
1717
List<String> permissionList = new ArrayList<>();
18-
permissionList.add(Manifest.permission.READ_EXTERNAL_STORAGE);
19-
permissionList.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
2018
permissionList.add(Manifest.permission.RECORD_AUDIO);
2119
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
2220
permissionList.add(Manifest.permission.READ_PHONE_STATE);

Android/APIExample-Audio/build.gradle

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
plugins {
3-
id 'com.android.application' version '7.2.0' apply false
4-
id 'com.android.library' version '7.2.0' apply false
5-
}
6-
7-
task clean(type: Delete) {
8-
delete rootProject.buildDir
3+
id 'com.android.application' version '8.5.0' apply false
4+
id 'org.jetbrains.kotlin.android' version '1.9.24' apply false
95
}

Android/APIExample-Audio/cloud_build.sh

+13
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@
33
# cache gradle to /tmp/.gradle
44
ls ~/.gradle || (mkdir -p /tmp/.gradle && ln -s /tmp/.gradle ~/.gradle && touch ~/.gradle/ln_$(date "+%y%m%d%H") && ls ~/.gradle)
55

6+
## use open jdk 17
7+
SYSTEM=$(uname -s)
8+
if [ "$SYSTEM" = "Linux" ];then
9+
if [ ! -d "/tmp/jdk-17.0.2" ];then
10+
curl -O https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz
11+
tar zxf openjdk-17.0.2_linux-x64_bin.tar.gz
12+
mv jdk-17.0.2 /tmp/
13+
fi
14+
export JAVA_HOME=/tmp/jdk-17.0.2
15+
export PATH=$JAVA_HOME/bin:$PATH
16+
java --version
17+
fi
18+
619
#change android maven to china repos
720
sed -ie "s#google()#maven { url \"https\://maven.aliyun.com/repository/public\" }\n google()#g" settings.gradle
821
sed -ie "s#https://services.gradle.org/distributions#https://mirrors.cloud.tencent.com/gradle#g" gradle/wrapper/gradle-wrapper.properties

Android/APIExample-Audio/gradle.properties

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ org.gradle.jvmargs=-Xmx1536m
1717
android.useAndroidX=true
1818
# Automatically convert third-party libraries to use AndroidX
1919
android.enableJetifier=true
20+
android.nonTransitiveRClass=false
21+
android.nonFinalResIds=false
2022

2123
# read enable simple filter section on README first before set this flag to TRUE
2224
simpleFilter = false
2325

24-
rtc_sdk_version = 4.5.1
26+
rtc_sdk_version = 4.5.2

Android/APIExample-Audio/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-7.3.3-bin.zip
6+
distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-8.7-bin.zip

Android/APIExample-Compose/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
.externalNativeBuild
1414
.cxx
1515
local.properties
16+
/.idea

Android/APIExample-Compose/app/build.gradle.kts

+7-12
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ val localSdkPath = "${rootProject.projectDir.absolutePath}/../../sdk"
1717

1818
android {
1919
namespace = "io.agora.api.example.compose"
20-
compileSdk = 34
20+
compileSdk = 35
2121

2222
defaultConfig {
2323
applicationId = "io.agora.api.example.compose"
2424
minSdk = 24
25-
targetSdk = 34
25+
targetSdk = 35
2626
versionCode = 1
2727
versionName = "1.0"
2828

@@ -53,6 +53,7 @@ android {
5353

5454
buildFeatures {
5555
buildConfig = true
56+
compose = true
5657
}
5758
buildTypes {
5859
debug {
@@ -69,17 +70,14 @@ android {
6970
}
7071
}
7172
compileOptions {
72-
sourceCompatibility = JavaVersion.VERSION_1_8
73-
targetCompatibility = JavaVersion.VERSION_1_8
73+
sourceCompatibility = JavaVersion.VERSION_17
74+
targetCompatibility = JavaVersion.VERSION_17
7475
}
7576
kotlinOptions {
76-
jvmTarget = "1.8"
77-
}
78-
buildFeatures {
79-
compose = true
77+
jvmTarget = "17"
8078
}
8179
composeOptions {
82-
kotlinCompilerExtensionVersion = "1.5.1"
80+
kotlinCompilerExtensionVersion = "1.5.14"
8381
}
8482
packaging {
8583
resources {
@@ -136,8 +134,5 @@ dependencies {
136134
} else {
137135
implementation("io.agora.rtc:full-sdk:${agoraSdkVersion}")
138136
implementation("io.agora.rtc:full-screen-sharing:${agoraSdkVersion}")
139-
// implementation(libs.agora.full.sdk)
140-
// implementation(libs.agora.full.screen.sharing)
141137
}
142-
143138
}

0 commit comments

Comments
 (0)