MQTTCHAT Android Installation guide

1 - Register to mqttchat and add your domain name to your domains list.

2 - Go to the settings section of your customer area to get your APP_ID and APP_SECRET.



MQTTCHAT Android Integration guide

1 - Importing the Library

Add MQTTCHAT Artifactory repository to the list of Maven repositories in your top level build.gradle file:


allprojects {
    repositories {       
        maven {
            url "http://mqttchat.telifoun.com:8081/artifactory/libs-release-local"
            credentials {
                username = "mqttchat"
                password = "telifoun"
            }
        }
    }
}
Add MQTT CHAT artifacts as a dependencies in the build.gradle file of your main project:


dependencies {
    implementation 'com.telifoun.mqttchat:mqttchat-core:1.0.0'
    implementation 'com.telifoun.mqttchat:mqttchat-gui:1.0.0'
}

2 - MQTTCHAT Initialisation.

In Application class of your Android App add the following code to init MQTTCHAT:


new Mqttchat.getBuilder()
             .context(this.getApplicationContext())
             .appName(getApplicationContext().getResources().getString(R.string.app_name))
             .appIcon(R.drawable.ic_launcher)
             .domain("your_domain.com")
             .appId("App_Id")
             .appSecret("App_Secret")
             .showBackButton(true)
             .debugMode(false)
             .useFriends(false)
             .build();

3 - Connect User.

In LoginActivity After user login success, Connect user to MQTTCHAT using login function.


 Mqttchat.getmInstance().logIn(getApplication(), userId, new Callback() {
   @Override
   public void OK(Object o) {
   }
   @Override
   public void KO(String s) {
   }
   });

4 - Lounch Chat.

Once the user is connected to MQTTCHAT you can launch chat interface whenever you want using this code :


 Mqttchat.getmInstance().lounchMqttChat(getApplicationContext(), new Callback() {
   @Override
   public void OK(Object o) {
   }
   @Override
   public void KO(String s) {   
   }
});

That is all. For advanced integration, please consult the complete MQTTCHAT Android documentation.

2020 © Telifoun.MQTTCHAT Inc.