Hide last authors
SandrineAvakian 16.1 1 {{box cssClass="floatinginfobox" title="**Contents**"}}
Sylvain Berfini 46.1 2 {{toc/}}
SandrineAvakian 16.1 3 {{/box}}
Sylvain Berfini 17.1 4
Simon Morlat 25.2 5 = Using Liblinphone =
SandrineAvakian 1.1 6
Sylvain Berfini 49.2 7 Don't forget to check out or tutorials : [[https:~~/~~/gitlab.linphone.org/BC/public/tutorials>>https://gitlab.linphone.org/BC/public/tutorials]]
Sylvain Berfini 41.1 8
Sylvain Berfini 49.2 9
SandrineAvakian 14.1 10 == Requirements ==
11
SandrineAvakian 4.1 12 Fisrt of all, install the Android SDK from the official site. Then run the android binary and install the following:
SandrineAvakian 1.1 13
SandrineAvakian 4.1 14 * Android SDK Tools
15 * Android SDK Platform-tools
16 * Android SDK Build-tools
Simon Morlat 25.2 17 * An Android SDK platform
SandrineAvakian 1.1 18
Sylvain Berfini 43.1 19 Please take an eye on the [[README>>https://gitlab.linphone.org/BC/public/linphone-android/blob/master/README.md]] and [[ChangeLog>>https://gitlab.linphone.org/BC/public/linphone-android/blob/master/CHANGELOG.md]] files from the git repo in order to make sure to have always up to date information about the project.
Sylvain Berfini 24.1 20
Sylvain Berfini 43.1 21 Note that the README provide detailed instructions to compile the linphone app and liblinphone SDK, which is not required to simply use the SDK in your own app.
Sylvain Berfini 41.1 22
Sylvain Berfini 43.1 23
SandrineAvakian 4.1 24 == Create your project ==
25
SandrineAvakian 1.1 26 Create a directory for your new project, then, create your project. You can either use the assistant from your IDE (Eclipse or Android Studio), or the command line:
27
SandrineAvakian 3.1 28 {{code}}
SandrineAvakian 1.1 29 android create project -n [project_name] -t [target_android_version] -p [path_to_project_dir] -k [package_name] -a [default_activity_name]
SandrineAvakian 3.1 30 {{/code}}
SandrineAvakian 1.1 31
32 If you do create your project using the command line, you can still import it in your IDE.
SandrineAvakian 4.1 33 For Eclipse , go to File -> Import -> Android - Existing Android Code Into Workspace.
SandrineAvakian 1.1 34
Sylvain Berfini 24.1 35
Simon Morlat 25.2 36 == Importing liblinphone SDK ==
SandrineAvakian 1.1 37
Simon Morlat 25.2 38 Two options are available. The first one is to configure our maven repository in your build.gradle file and add our SDK dependency. The second one is to manually download and install our SDK.
Sylvain Berfini 22.1 39
Sylvain Berfini 41.1 40
Sylvain Berfini 43.1 41 === Use our Maven repository ===
Sylvain Berfini 22.1 42
43 Edit your top level gradle build file and edit the allprojects' repositories list to add our own:
44
45 {{code}}
46 maven {
Sylvain Berfini 51.1 47 name "linphone.org maven repository"
Sylvain Berfini 42.1 48 url "https://linphone.org/maven_repository/"
Sylvain Berfini 51.1 49 content {
50 includeGroup "org.linphone"
51 }
Sylvain Berfini 22.1 52 }
53 {{/code}}
54
55 Then in your app's gradle build file add the either one of the following to your dependencies list:
56
57 {{code}}
Sylvain Berfini 50.1 58 debugImplementation "org.linphone:linphone-sdk-android-debug:5.0+"
59 releaseImplementation "org.linphone:linphone-sdk-android:5.0+"
Sylvain Berfini 22.1 60 {{/code}}
61
Sylvain Berfini 32.2 62 Before 4.0.1 there is only a release implementation available !
63
Sylvain Berfini 22.1 64
Sylvain Berfini 32.2 65 Changes starting with 4.1:
66
67 * The artifact id is now linphone-android-sdk instead of liblinphone-sdk.
68 * A no-video build is available with the group id org.linphone.no-video instead of org.linphone.
Sylvain Berfini 33.1 69 * The javadoc is also available with the release AAR
Sylvain Berfini 32.2 70
Sylvain Berfini 45.1 71 Here's a sample on how to the latest snapshot:
Sylvain Berfini 34.1 72
73 {{code}}
Sylvain Berfini 50.1 74 debugImplementation "org.linphone:linphone-sdk-android-debug:5.0+"
75 releaseImplementation "org.linphone:linphone-sdk-android:5.0+"
Sylvain Berfini 34.1 76 {{/code}}
77
Sylvain Berfini 36.1 78 For the no-video builds, use
79
80 {{code}}
Sylvain Berfini 50.1 81 debugImplementation "org.linphone.no-video:linphone-sdk-android-debug:5.0+"
82 releaseImplementation "org.linphone.no-video:linphone-sdk-android:5.0+"
Sylvain Berfini 36.1 83 {{/code}}
84
Sylvain Berfini 43.1 85 If you want the smallest AAR available (with most of the features being disabled to gain some space such as video, advanced IM, sqlite, vCard, MKV, plugins, etc...):
86
87 {{code}}
Sylvain Berfini 50.1 88 debugImplementation "org.linphone.minimal:linphone-sdk-android-debug:5.0+"
89 releaseImplementation "org.linphone.minimal:linphone-sdk-android:5.0+"
Sylvain Berfini 43.1 90 {{/code}}
91
Sylvain Berfini 49.1 92 Finally, for those who still uses the old Java wrapper but still want to be able to update the library, we have created a legacy package.
Sylvain Berfini 37.1 93
Sylvain Berfini 49.1 94 {{warning}}
95 4.5.x release is the last one that will support it.
96 {{/warning}}
97
Sylvain Berfini 37.1 98 {{code}}
Sylvain Berfini 49.1 99 debugImplementation "org.linphone.legacy:linphone-sdk-android-debug:4.5+"
100 releaseImplementation "org.linphone.legacy:linphone-sdk-android:4.5+"
Sylvain Berfini 37.1 101 {{/code}}
102
Sylvain Berfini 38.1 103 {{warning}}
104 Keep in mind that the debug AAR is a lot bigger than the release one, thus the APK installation will take some time.
105 So for day to day development, you can use the release AAR to have faster builds.
106 {{/warning}}
107
Sylvain Berfini 41.1 108
Sylvain Berfini 51.1 109 === Use a private maven repository ===
110
111 If you are using a private maven repository, here's how to configure and use it:
112
Sylvain Berfini 51.2 113 {{code}}
Sylvain Berfini 51.1 114 maven {
115 credentials {
116 username "<user>"
117 password "<password>"
118 }
119
120 authentication {
121 basic(BasicAuthentication)
122 }
123
124 name "<Maven repository name>"
125 url "<maven repository url>"
126
127 content {
128 includeGroup "org.linphone"
129 }
130 }
131 {{/code}}
132
133
Sylvain Berfini 46.1 134 === Download our SDK (not recommended) ===
Sylvain Berfini 22.1 135
Sylvain Berfini 41.1 136 You can download the AAR directly from the [[maven repository>>https://linphone.org/releases/maven_repository/org/linphone/linphone-sdk-android/]].
SandrineAvakian 1.1 137
Sylvain Berfini 41.1 138 To configure your project, put the aar in the libs/ directory should be enough.
SandrineAvakian 2.1 139
Erwan Croze 17.5 140 In your build.gradle add in repositories:
SandrineAvakian 1.1 141
Erwan Croze 17.5 142 {{code}}
143 repositories {
144 ...
145 flatDir { dirs 'libs' }
146 }
147 {{/code}}
SandrineAvakian 1.1 148
Erwan Croze 17.5 149 If for some reason it's not (for example if you decided to put the aar in another folder), just add the folder to //flatDir//.
150
151 And in dependencies:
152
153 {{code}}
154 repositories {
155 ...
Sylvain Berfini 29.1 156 //compile(name:'liblinphone-sdk-release', ext:'aar') This was the old way and still works but you'll have a warning
157 implementation 'org.linphone.core:liblinphone-sdk-release@aar'
Erwan Croze 17.5 158 }
159 {{/code}}
160
Simon Morlat 25.2 161 And now you have liblinphone sdk integrated in your project.
Erwan Croze 17.5 162
Sylvain Berfini 27.1 163 You can try your setup by trying to start a sample Core:
SandrineAvakian 1.1 164
Sylvain Berfini 27.1 165 {{code}}
166 Factory.instance().setDebugMode(true, "Linphone");
Sylvain Berfini 28.1 167 // You must provide the Android app context as createCore last param !
Sylvain Berfini 43.1 168 Core core = Factory.instance().createCore(null, null, this.getApplicationContext());
Sylvain Berfini 27.1 169 core.start();
170 {{/code}}
171
Sylvain Berfini 28.1 172 {{error}}
173 You MUST provide the Android app context as createCore last param !
174 {{/error}}
Sylvain Berfini 27.1 175
Sylvain Berfini 46.1 176 == ==
177
Sylvain Berfini 50.1 178 == ==
179
Simon Morlat 25.2 180 == Using liblinphone API ==
SandrineAvakian 1.1 181
Sylvain Berfini 47.1 182 The [[JAVA reference API documentation>>https://linphone.org/snapshots/docs/liblinphone/4.5.0/java/]] is browsable here.
SandrineAvakian 1.1 183
Sylvain Berfini 48.1 184 You can also download the source code of Linphone Android (see the Source Code on [[this page>>https://gitlab.linphone.org/BC/public/linphone-android]]).
SandrineAvakian 1.1 185
Sylvain Berfini 50.1 186 Finally a bunch of [[tutorials are available>>https://gitlab.linphone.org/BC/public/tutorials]].
187
188
Simon Morlat 26.1 189 == Compile your app and run ==
SandrineAvakian 1.1 190
191 Nothing specific to do, just compile it as a normal Android application (on Eclipse, right click on the project -> Run as -> Android Application).
192
Sylvain Berfini 24.1 193
SandrineAvakian 8.1 194 = Troubleshooting =
SandrineAvakian 2.1 195
Sylvain Berfini 17.3 196 [[Activate debug traces>>http://www.linphone.org/docs/liblinphone-javadoc/org/linphone/core/LinphoneCoreFactory.html]] with setDebugMode(boolean, string);
SandrineAvakian 2.1 197
SandrineAvakian 1.1 198 To get debug traces from adb:
SandrineAvakian 9.1 199 {{code}}adb logcat {{/code}}
SandrineAvakian 1.1 200
201 To get symbolicated stack trace from adb, use:
Sylvain Berfini 17.2 202 {{code}}adb logcat -d | ndk-stack -sym ./libs-debug/`adb shell getprop ro.product.cpu.abi | tr -d '\r'` {{/code}}