Hide last authors
Sylvain Berfini 1.1 1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc /}}
3 {{/box}}
4
5 = Xamarin SDK =
6
jehan monnier 35.1 7 To use Linphone with Xamarin, you need the Xamarin SDK which contains the native libraries for Android, iOS {{comment}} and Windows 10{{/comment}} (for each architecture) and the C# wrapper that matches those libraries.
Sylvain Berfini 1.1 8
Sylvain Berfini 29.1 9 You can build your own SDK (see [[Linphone SDK>>https://gitlab.linphone.org/BC/public/linphone-sdk]] README file) or you can download a pre-built ZIP archive with the native libraries for both Android & iOS plus the C# wrapper.
Sylvain Berfini 1.1 10
jehan monnier 39.1 11 Pre-built SDK are available at in two flavors: [[releases>>https://linphone.org/releases/xamarin/]] or [[nightly builds>>https://linphone.org/snapshots/xamarin/]]. Nightly builds are built every night from the master branch of linphone-sdk instead of release branch.
Sylvain Berfini 1.1 12
Sylvain Berfini 29.1 13
Sylvain Berfini 1.1 14 == What's in the box ==
15
16 The Xamarin SDK embed the following:
17
Sylvain Berfini 1.2 18 * The C# wrapper (named LinphoneWrapper.cs) ;
Sylvain Berfini 29.1 19 * The Android libraries for armv7, arm64 (as AAR) ;
Sylvain Berfini 7.1 20 * The iOS libraries for armv7, arm64 and x86_64 (as frameworks) ;
Sylvain Berfini 29.1 21 * A sample solution based on Xamarin Forms for both Android and iOS platforms.
Sylvain Berfini 1.1 22
Sylvain Berfini 29.1 23 If you want to support an architecture that is not included in our SDK (for example x86), you can compile the libraries by yourself (see above).
Sylvain Berfini 1.1 24
25
Sylvain Berfini 29.1 26 == Architecture ==
Sylvain Berfini 1.1 27
Sylvain Berfini 29.1 28 Once you have our SDK (either built by yourself or a pre-built archive you downloaded), you can open the Xamarin.sln solution inside the Xamarin folder of our [[sample app>>https://gitlab.linphone.org/BC/public/linphone-xamarin]].
Sylvain Berfini 1.1 29
Sylvain Berfini 29.1 30 The sample we provide is a solution using four projects: one for Android, one for iOS, and two shared: one for the native libraries (our SDK), one for the app itself (the shared part).
Sylvain Berfini 1.1 31
Sylvain Berfini 29.1 32 The Android project contains the Android Manifest for the generated APK and an Activity that will load and display the application from the shared project.
Sylvain Berfini 1.1 33
34 The iOS project does the same thing that the Android one, but for iOS (obviously).
Sylvain Berfini 30.1 35
36
37 == Set-up the SDK ==
38
39 === Android ===
40
Sylvain Berfini 39.2 41 If you haven't done it already, also **copy the C# wrapper** in linphone-sdk-ios\linphone-sdk\apple-darwin\share\linphonecs\LinphoneWrapper.cs into Xamarin\Xamarin\Xamarin\LinphoneWrapper.cs (the name must remain the same).
Sylvain Berfini 30.1 42
43 For the C# wrapper to work, it needs to find the Linphone native libraries. Here's the procedure to add them to the project:
44
Sylvain Berfini 39.2 45 **Copy the AAR** with the native libraries (either the debug or the release one) into Xamarin\Xamarin\Liblinphone\liblinphone-sdk.aar (the name must remain the same).
Sylvain Berfini 30.1 46
47
48 === iOS ===
49
Sylvain Berfini 39.2 50 If you haven't done it already, also **copy the C# wrapper** in linphone-sdk-ios\linphone-sdk\apple-darwin\share\linphonecs\LinphoneWrapper.cs into Xamarin\Xamarin\Xamarin\LinphoneWrapper.cs (the name must remain the same).
Sylvain Berfini 30.1 51
52 For the C# wrapper to work, it needs to find the Linphone native libraries. Here's the procedure to add them to the project:
53
Sylvain Berfini 39.2 54 * **Import the Frameworks** folder with all the frameworks within your Xamarin.iOS project ;
55 * Right click on your Xamarin.iOS project then select add -> add native references and **select all the frameworks** you imported in the project.
Sylvain Berfini 30.1 56
57 Do not forget to add your required permissions in your project Info.plist (i.e: use of microphone etc...) or your app will crash !
58
59 == Platform specifics ==
60
Sylvain Berfini 37.1 61 === Android ===
Sylvain Berfini 30.1 62
Sylvain Berfini 36.1 63 Don't forget to add the required permissions to the AndroidManifest.xml file. Here's the list of all permissions our SDK might need:
Sylvain Berfini 30.1 64
65 {{code}}
66 <uses-permission android:name="android.permission.RECORD_AUDIO" />
67 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
68 <uses-permission android:name="android.permission.WAKE_LOCK" />
69 <!-- Needed to be able to use WifiManager.MulticastLock -->
70 <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
71 <uses-permission android:name="android.permission.CAMERA" />
72 <!-- Needed to allow Linphone to install on tablets, since android.permission.CAMERA implies android.hardware.camera and android.hardware.camera.autofocus are required -->
73 <uses-feature android:name="android.hardware.camera" android:required="false" />
74 {{/code}}
75
76 Finally if you are deploying on Android >= 23 ask at runtime the permissions like you would do on a native Android application.
77
Sylvain Berfini 37.1 78
79 === iOS ===