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 === Download our SDK (not recommended) ===
135
136 You can download the AAR directly from the [[maven repository>>https://linphone.org/releases/maven_repository/org/linphone/linphone-sdk-android/]].
137
138 To configure your project, put the aar in the libs/ directory should be enough.
139
140 In your build.gradle add in repositories:
141
142 {{code}}
143 repositories {
144 ...
145 flatDir { dirs 'libs' }
146 }
147 {{/code}}
148
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 ...
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'
158 }
159 {{/code}}
160
161 And now you have liblinphone sdk integrated in your project.
162
163 You can try your setup by trying to start a sample Core:
164
165 {{code}}
166 Factory.instance().setDebugMode(true, "Linphone");
167 // You must provide the Android app context as createCore last param !
168 Core core = Factory.instance().createCore(null, null, this.getApplicationContext());
169 core.start();
170 {{/code}}
171
172 {{error}}
173 You MUST provide the Android app context as createCore last param !
174 {{/error}}
175
176 == ==
177
178 == ==
179
180 == Using liblinphone API ==
181
182 The [[JAVA reference API documentation>>https://linphone.org/snapshots/docs/liblinphone/4.5.0/java/]] is browsable here.
183
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]]).
185
186 Finally a bunch of [[tutorials are available>>https://gitlab.linphone.org/BC/public/tutorials]].
187
188
189 == Compile your app and run ==
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
193
194 = Troubleshooting =
195
196 [[Activate debug traces>>http://www.linphone.org/docs/liblinphone-javadoc/org/linphone/core/LinphoneCoreFactory.html]] with setDebugMode(boolean, string);
197
198 To get debug traces from adb:
199 {{code}}adb logcat {{/code}}
200
201 To get symbolicated stack trace from adb, use:
202 {{code}}adb logcat -d | ndk-stack -sym ./libs-debug/`adb shell getprop ro.product.cpu.abi | tr -d '\r'` {{/code}}