Write your First mesibo Enabled Application - XamarinEstimated reading time: 3 minutes
- Create Users
- Hosting Media & Files
- Sync Messages
In this part, we will learn how to use mesibo SDKs in Xamarin to add messaging, calls, conferencing, and chatbot to your cross-platform Android and iOS application. Since we have already covered Android and iOS apps, we will not repeat the same information here. Instead, we suggest your read one of the Android or iOS sections.
Prerequisites and Download Source Code
- Read the section Create Users to learn about creating an app in mesibo console and creating users & access tokens for your app.
- Read the Android or iOS section to get familiarized with APIs
- Download the source code for the First mesibo Xamarin App from GitHub which we will use in this.
In this step, we will configure and build the First App. Once you run it, we will get into more details.
Step 1 Create a Multiplatform Project
Start Visual Studio and create a new multiplatform project
Step 2 Install Mesibo SDKs
Before we can use mesibo in this app, we need to add mesibo SDKs to this project from NuGet as explained in the installation instructions.
To install the mesibo Xamarin libraries, right-click on the solution in the Solution Explorer and install mesibo NuGet Packages:
- com.mesibo.api - core mesibo library
- com.mesibo.ui - mesibo messaging user interface
- com.mesibo.calls - mesibo calls and conferencing user interface
Note: while mesibo Xamarin libraries are based on stable mesibo Android and iOS libraries, we are still mapping all the APIs and callbacks. Please raise a ticket if you face any issues using mesibo Xamarin libraries.
Step 3 Configure Build Settings
For Android, it is recommended to set the SDK to the latest.
For iOS, configure the build settings as shown below, for both Debug and Release builds. Go to iOS project options -> iOS Build -> Additional mtouch arguments and enter
Step 4 Copy Sample Source Code from GitHub
Download the source code for the First mesibo Xamarin App from GitHub which we will use in this project.
In the sample app, we have created a
mesibointerface.cs which will be used by the platform-independent .Net code to carry out Android and iOS operations.
We have also provided basic code to initialize mesibo, launch messaging UI, and make audio and video calls, for both
Copy all the code to the app that we have created now. Also, copy
AndroidManifest.xml for necessary permissions.
Step 5 Create User Tokens
Before we can build and run the app, we need to configure the app with valid mesibo user tokens as explained in Create Users section.
Create tokens for two users, each with the User Address
456 and App ID
com.mesibo.firstapp and configure two demo users in the source code with the tokens you have generated.
Step 6 Build and Run
Build and Run the project. It may take a few seconds.
You should install the app on two devices. On the first device, click on the
Login as User1 button and on another device, click on the
Login as User2 button. You can also use mesibo messenger apps for Android, iOS or Web to test your implementation.
If you add a breakpoint on
Mesibo_OnConnectionStatus, you will see that it cycles through various status information. Finally, you should receive
status=1 which indicates that your app is successfully connected to the mesibo real-time server and ready to send and receive real-time messages.
You can now send messages to each other and can also make voice and video calls.
If you check the logs or add a breakpoint on
Mesibo_OnMessage, you can see that you got the message in