Write your First mesibo Enabled ApplicationEstimated reading time: 4 minutes
- File Transfer
- UI Modules
- Voice and Video Calls
In this part, we will create a simple real-time app for Android.
You MUST go through following prerequisites before you read further.
- Read the Preparation Guide.
- Knowledge of using Android Studio and making basic Android Apps
First Android App
Now let’s quickly start coding:
- Start Android Studio.
- Create a new project with minimum SDK version 16 or higher.
- Android Studio starts Gradle and builds your project. This may take a few seconds. For more information about creating a project in Android Studio, see the Android Studio documentation. https://developer.android.com/training/basics/firstapp/creating-project.html
- Add mesibo SDK to your project by adding gradle dependency and performing gradle sync as explained in installation instructions.
- Import mesibo API and add mesibo initialization code in your onCreate method
Extend your activity to Implement
mesibo.ConnectionListner class and implement listeners. The easiest way is to click on the
Code menu and click on
Implement Methods and it will automatically generate the code for all the methods.
That’s it - you are now ready to receive your first real-time message.
Testing your first application
- Compile and Run Application.
Mesibo_onConnectionStatusshould cycle through various status information. Finally, you should receive
status=1which indicates that your app is successfully connected to mesibo real-time server and ready to send and receive real-time messages.
- Since we do not have any other users right now, we will use mesibo console to send a test message. In a later section, we will learn how to send messages from the app itself.
- Go to Console ->Application->Users. You should see the user you have created.
- Go to user details by clicking
Editbutton. Scroll down, you will see a section to
- Enter 1000 (or anything) in
Create This Usercheckbox, type message and click on
- You will instantly receive this message in your mobile app in
In previous section, we have used mesibo console to send a message. Now we will quickly learn how to send messages from app itself. To send messages, we will use
sendMessage real-time API for which we will need destination user, message id and message itself.
Invoke the following function anywhere from your code to send a text message. In later section, we will learn how to send rich messages.
That’s it! Try it out by creating two instances of the app and send message to each other by using above function.
Download Sample Application
You can download the entire sample application from GitHubmesibo, android, ios