Browse Source

Android: Update Gradle and SaltyRTC, build for API27

master
Danilo Bargen 1 year ago
parent
commit
b20e9827d6

+ 1
- 1
README.md View File

@@ -52,7 +52,7 @@ computer and run the following command:

## License

Copyright (c) 2016-2017 Threema GmbH
Copyright (c) 2016-2018 Threema GmbH

Licensed under the Apache License, Version 2.0, <see LICENSE-APACHE file>
or the MIT license <see LICENSE-MIT file>, at your option. This file may not be

+ 12
- 8
android/app/build.gradle View File

@@ -1,11 +1,15 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 24
compileSdkVersion 27
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "org.saltyrtc.demo.app"
minSdkVersion 21
targetSdkVersion 24
targetSdkVersion 27
versionCode 2
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -22,15 +26,15 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
testImplementation 'junit:junit:4.12'

compile('org.saltyrtc.client:saltyrtc-client:0.10.+', {
implementation('org.saltyrtc.client:saltyrtc-client:0.11.+', {
exclude group: 'org.json', module: 'json'
})
compile 'org.saltyrtc.tasks.webrtc:saltyrtc-task-webrtc:0.11.+'
compile 'com.noveogroup.android:android-logger:1.3.1'
implementation 'org.saltyrtc.tasks.webrtc:saltyrtc-task-webrtc:0.13.+'
implementation 'com.noveogroup.android:android-logger:1.3.1'
}

+ 17
- 8
android/app/src/main/java/org/saltyrtc/demo/app/WebRTC.java View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2017 Threema GmbH
* Copyright (c) 2016-2018 Threema GmbH
*
* Licensed under the Apache License, Version 2.0, <see LICENSE-APACHE file>
* or the MIT license <see LICENSE-MIT file>, at your option. This file may not be
@@ -41,22 +41,31 @@ class WebRTC {
this.activity = activity;

// Initialize Android globals
// See https://bugs.chromium.org/p/webrtc/issues/detail?id=3416
PeerConnectionFactory.initializeAndroidGlobals(activity, false);
PeerConnectionFactory.initialize(
PeerConnectionFactory.InitializationOptions.builder(activity)
.setEnableInternalTracer(BuildConfig.DEBUG)
.createInitializationOptions()
);

// Set ICE servers
List<PeerConnection.IceServer> iceServers = new ArrayList<>();
iceServers.add(new org.webrtc.PeerConnection.IceServer("stun:" + Config.STUN_SERVER));
final List<PeerConnection.IceServer> iceServers = new ArrayList<>();
iceServers.add(
PeerConnection.IceServer.builder("stun:" + Config.STUN_SERVER).createIceServer()
);
if (Config.TURN_SERVER != null) {
iceServers.add(new org.webrtc.PeerConnection.IceServer("turn:" + Config.TURN_SERVER,
Config.TURN_USER, Config.TURN_PASS));
iceServers.add(
PeerConnection.IceServer.builder("turn:" + Config.TURN_SERVER)
.setUsername(Config.TURN_USER)
.setPassword(Config.TURN_PASS)
.createIceServer()
);
}

// Create peer connection
final PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
this.factory = new PeerConnectionFactory(options);
this.constraints = new MediaConstraints();
this.pc = this.factory.createPeerConnection(iceServers, constraints, new PeerConnectionObserver());
this.pc = this.factory.createPeerConnection(iceServers, new PeerConnectionObserver());

// Add task message event handler
this.task.setMessageHandler(new TaskMessageHandler());

+ 3
- 1
android/build.gradle View File

@@ -3,9 +3,10 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.1.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@@ -15,6 +16,7 @@ buildscript {
allprojects {
repositories {
jcenter()
google()
}
}


+ 2
- 2
android/gradle/wrapper/gradle-wrapper.properties View File

@@ -1,6 +1,6 @@
#Tue Apr 17 09:29:38 CEST 2018
#Tue Apr 17 09:44:28 CEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

Loading…
Cancel
Save