Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
5 = Using Liblinphone =
6
7 Don't forget to check out or tutorials : [[https:~~/~~/gitlab.linphone.org/BC/public/tutorials>>https://gitlab.linphone.org/BC/public/tutorials]]
8
9
10 == Requirements ==
11
12 Fisrt of all, install the Android SDK from the official site. Then run the android binary and install the following:
13
14 * Android SDK Tools
15 * Android SDK Platform-tools
16 * Android SDK Build-tools
17 * An Android SDK platform
18
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.
20
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.
22
23
24 == Create your project ==
25
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
28 {{code}}
29 android create project -n [project_name] -t [target_android_version] -p [path_to_project_dir] -k [package_name] -a [default_activity_name]
30 {{/code}}
31
32 If you do create your project using the command line, you can still import it in your IDE.
33 For Eclipse , go to File -> Import -> Android - Existing Android Code Into Workspace.
34
35
36 == Importing liblinphone SDK ==
37
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.
39
40
41 === Use our Maven repository ===
42
43 Edit your top level gradle build file and edit the allprojects' repositories list to add our own:
44
45 {{code}}
46 maven {
47 name "linphone.org maven repository"
48 url "https://linphone.org/maven_repository/"
49 content {
50 includeGroup "org.linphone"
51 }
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}}
58 debugImplementation "org.linphone:linphone-sdk-android-debug:5.0+"
59 releaseImplementation "org.linphone:linphone-sdk-android:5.0+"
60 {{/code}}
61
62 Before 4.0.1 there is only a release implementation available !
63
64
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.
69 * The javadoc is also available with the release AAR
70
71 Here's a sample on how to the latest snapshot:
72
73 {{code}}
74 debugImplementation "org.linphone:linphone-sdk-android-debug:5.0+"
75 releaseImplementation "org.linphone:linphone-sdk-android:5.0+"
76 {{/code}}
77
78 For the no-video builds, use
79
80 {{code}}
81 debugImplementation "org.linphone.no-video:linphone-sdk-android-debug:5.0+"
82 releaseImplementation "org.linphone.no-video:linphone-sdk-android:5.0+"
83 {{/code}}
84
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}}
88 debugImplementation "org.linphone.minimal:linphone-sdk-android-debug:5.0+"
89 releaseImplementation "org.linphone.minimal:linphone-sdk-android:5.0+"
90 {{/code}}
91
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.
93
94 {{warning}}
95 4.5.x release is the last one that will support it.
96 {{/warning}}
97
98 {{code}}
99 debugImplementation "org.linphone.legacy:linphone-sdk-android-debug:4.5+"
100 releaseImplementation "org.linphone.legacy:linphone-sdk-android:4.5+"
101 {{/code}}
102
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
108
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
113 {{code}}
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
134
135 === Download our SDK (not recommended) ===
136
137 You can download the AAR directly from the [[maven repository>>https://linphone.org/releases/maven_repository/org/linphone/linphone-sdk-android/]].
138
139 To configure your project, put the aar in the libs/ directory should be enough.
140
141 In your build.gradle add in repositories:
142
143 {{code}}
144 repositories {
145 ...
146 flatDir { dirs 'libs' }
147 }
148 {{/code}}
149
150 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//.
151
152 And in dependencies:
153
154 {{code}}
155 repositories {
156 ...
157 //compile(name:'liblinphone-sdk-release', ext:'aar') This was the old way and still works but you'll have a warning
158 implementation 'org.linphone.core:liblinphone-sdk-release@aar'
159 }
160 {{/code}}
161
162 And now you have liblinphone sdk integrated in your project.
163
164 You can try your setup by trying to start a sample Core:
165
166 {{code}}
167 Factory.instance().setDebugMode(true, "Linphone");
168 // You must provide the Android app context as createCore last param !
169 Core core = Factory.instance().createCore(null, null, this.getApplicationContext());
170 core.start();
171 {{/code}}
172
173 {{error}}
174 You MUST provide the Android app context as createCore last param !
175 {{/error}}
176
177 (% class="wikigeneratedid" %)
178
179
180
181
182
183 == Using liblinphone API ==
184
185 The [[JAVA reference API documentation>>https://download.linphone.org/releases/docs/liblinphone/latest/java/]] is browsable here.
186
187 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]]).
188
189 Finally a bunch of [[tutorials are available>>https://gitlab.linphone.org/BC/public/tutorials]].
190
191 == Compile your app and run ==
192
193 Nothing specific to do, just compile it as a normal Android application (on Eclipse, right click on the project -> Run as -> Android Application).
194
195
196 = Troubleshooting =
197
198 Activate debug traces using [[Factory.instance().setDebugMode(true, "appName");>>https://download.linphone.org/releases/docs/liblinphone/latest/java/org/linphone/core/Factory.html#setDebugMode-boolean-java.lang.String-]]
199
200 To get debug traces from adb:
201 {{code}}adb logcat {{/code}}
202
203 To get symbolicated stack trace from adb, use:
204 {{code}}adb logcat -d | ndk-stack -sym ./libs-debug/`adb shell getprop ro.product.cpu.abi | tr -d '\r'` {{/code}}