September 19, 2018

Bring Real-Time Communication To Your Xamarin Apps... With CometChat!

Bring Real-Time Communication To Your Xamarin Apps... With CometChat!

Xamarin is in… and pretty much here to stay! And, there’s a pretty good reason why…

Xamarin is a cross-platform visual studio based toolset that delivers applications in windows, iOS, Android with a single shared .net/C# code base!

What’s so special about it? Earlier, developers would need to build 3 different apps for 3 different platforms, with 3 different code bases.

With Xamarin, you just need one language and one code base! Written in a single .net code base, the same application runs on all major mobile OS giants viz. Android, iOS, windows!

Xamarin Is The Future Of Application Development!

The very concept of Xamarin makes it a winner. Something that enables an application to on all platforms, uninterrupted, sharing the same code, is a masterpiece! Here are some features that make it a must-have tool for app developers!

  • Native User Interfaces: Apps built using Xamarin contain standard, native user interface controls. Apps do look the way the end user expects.
  • Native API Access: Apps built using Xamarin have access to the full spectrum of functionality exposed by the underlying platform and device, including platform-specific capabilities like ARKit and Android Multi-Window mode.
  • Native Performance: There are no glitches, no UI differences, no coding issues and no shortchanging on native features in the apps.
    Applications built with Xamarin behave exactly the way they would on their native platforms. Any app, even one built using Xamarin, is incomplete without a provision for real-time communication!

Why Do You Need Real-Time Communication Between Users On Your App?

On-the-go communication and an opportunity for collaboration enable your users to share their ideas, get connected to their fellow users, and build communities.

Think about the benefits for employees in an organization who need to collaborate on a particular project, but from different places.

Or a group of like-minded people who wish to share their ideas, get opinions, and the like. Real-time communication makes both, communication and collaboration more effective!

This continuing engagement contributes to broadening your user base by pulling in extra traffic on your app. You can monetize these very communities and rake in the revenue!

CometChat: Bring Real-Time Communication To Your Apps

There are millions of applications being developed out there, each with an active user base. CometChat is a multi-featured, conceptually developed Xamarin chat plugin that allows users on the app to communicate and collaborate!

The four things that define CometChat are listed below!

1. Users can communicate anytime… anywhere!

Features like voice & video calling, voice & video conference, one-on-one real-time text messaging, group real-time text messaging, help users engage in both. public and private communication.

2. Sharing ideas has never been easier…

Features like file sharing, collaborative whiteboard, collaborative document, screen sharing, help users send files, photos, and share ideas on the go!

3. Helps build communities… and rake in revenues!

CometChat helps you draw a huge number of users to your app/website, providing them with a pleasant chat experience, making them regular visitors and allowing them to have a number of user communities.

These communities can be monetized to generate added revenue. Role-Based Access Control and Credit-Based Billing can be used together to provide more functionality to the Premium Members.

4. Moderating is simple… and effective!

CometChat gives you the flexibility to customize your chat application according to your preferences. You enable/disable certain features/controls as you please. You can decide on which functionality users must be provided with!

Let’s take a detailed look at the features you must have, and that CometChat provides for real-time communication on your app!

Features To Encourage Communication And Collaboration!

One-on-one Chat

Your users can start using CometChat the instant they visit your site. A single click enables them to start chatting in real-time.

Group Chat

Lets users create a buzz and gather into a single place using groups. They can create public, password protected and invitation-only groups.

Voice & Video Calling & Conference

Users can voice call, switch to video call and even make a conference call with other users.

Stickers & Emojis

A vibrant and styled set of emojis help make the conversation more live and interesting.

Available In 9 Languages

The admin can choose to change the UI of the entire CometChat into a language of their preference!

Features That Take User Engagement To A Whole New Level!

Voice Notes

It allows users to send personalized messages recorded in their voices.

File Sharing

Enables users to share photos, files, on the go!

Collaborative Whiteboard

This collaboration tool helps users paint their ideas without having to leave the website, making communication more reliable than ever! There’s also the collaborative document that helps users edit documents on the go!

Don’t Build Chat From Scratch… Just Use CometChat For Your Xamarin Apps!

Building every chat feature from scratch demands a considerable amount of time to be spent on planning, development, testing, and deployment.

Not to forget the army of developers you’d have to hire, and the associated costs you’d have to bear!

The creation of a chat app, similar to CometChat in terms of complexity and the features available, would need around 150 hours dedicated to the UI/UX, and around 900 hours to the development.

You’d need to shell out at least $45000 – $55000 for a simple app. Installing CometChat, on the other hand, takes less than 20 minutes!

Here’s How You Can Add CometChat To Your Xamarin Apps!

CometChat can be integrated with Xamarin Apps using the CometChat SDK, with the complete source code for UI.

All features of CometChat including private chat, groups, real-time language translation and more will work effortlessly in the Xamarin apps, using this Xamarin chat SDK!

Here’s a video that captures how to build a Xamarin chat app from scratch with all the above features in just under 10 minutes!

If you’re old school and prefer reading like me, this is it:

Follow these steps for the integration!

Step 1: The first step is to add the NuGet packages for both Android/iOS.

For Android

  • Expand the Android project.
  • Right-click on the packages folder and click on Add packages.
  • Search for Xamarin.Android.CometChat package and add it to your project.
  • Search for Xamarin.Android.CometChat.UI package and add it to your project.

For iOS

  • Expand the iOS project.
  • Right-click on the packages folder and click on Add packages.
  • Search for Xamarin.iOS.CometChat package and add it to your project.
  • Search for Xamarin.iOS.CometChat.UI package and add it to your project.

Initialize the Chat

Once all the above steps are done, the first step to launch the Chat in your Xamarin application is to initialize the CometChat module. You need to use the below method to do so..


String siteurl = "";
String apiKey = "xxxxxxxxxxxxxxxxxxxxxx";
Boolean isCometOnDemand = true;
CometChat cometChat = CometChat.GetInstance(this.ApplicationContext);

new CometChatCallback((JSONObject obj) => {
/*code block on success */
}, (JSONObject obj) => {
/*code block on success */


String siteurl = "";
String apiKey = "xxxxxxxxxxxxxxxxxxxxxx";
Boolean isCometOnDemand = true;

cometchat = new CometChat();
readyUIFile = new readyUIFIle();
isCometOnDemand, (NSDictionary obj) => {
if (obj != null) {
Console.WriteLine("Init Success " + obj.ToString());
/*code block on success*/
}, (NSError obj) => {
if (obj != null) {
Console.WriteLine("Init Fail " + obj.ToString());
/*code block on fail*/

Log in to chat

The next step to launch the chat is to log in the user. CometChat provides a method LoginWithUID() to log the user into chat. We have already added 5 demo users to your account with the UIDs SUPERHERO1,SUPERHERO2,SUPERHERO3,SUPERHERO4 and SUPERHERO5.

You can use any of the users to log in. You can know morw about user managment here.


String UID = "SUPERHERO1" cometChat.LoginWithUID(this,UID, new CometChatCallback((JSONObject obj) => { /* code block for login success */ },(JSONObject obj) => { /* code block for login fail */ }));


String UID = "SUPERHERO1" cometChat.LoginWithUID(this,UID, new CometChatCallback((JSONObject obj) => { /* code block for login success */ },(JSONObject obj) => { /* code block for login fail */ }));

Launch Chat

In order to launch the chat, you need to use the LaunchCometChat() method.


Boolean isFullScreen = true;
new LaunchCallbacks(
successObj => successCall(successObj),
fail => failCall(fail),
onChatroomInfo => ChatroomInfo(onChatroomInfo),
onError => Error(onError),
onLogout => Logout(onLogout),
onMessageReceive => MessageReceive(onMessageReceive),
onUserInfo => UserInfo(onUserInfo),
onWindowClose => WindowClose(onWindowClose)));


readyUIFile = new readyUIFIle();
(userInfo) => OnUserInfo(userInfo),
groupInfo=> OnGroupInfo(groupInfo),
messageRecieve=> OnMessageRecieve(messageRecieve),
launchSuccess=> OnLaunchSuccess(launchSuccess),
launchFailure => OnLaunchFailure(launchFailure),
onLogout => OnLogout(onLogout));

Now that you have CometChat running successfully in your application, you can make further tweaks to change the looks of chat.

Want to know more? Follow the button below to see why should you use CometChat to add real time communication your Xamarin apps.

Xamarin Chat SDK

Related Posts

No items found.

Try Us for Free 

For as Long as You Like!