Skip to content

Instantly share code, notes, and snippets.

View Sunilkumarr's full-sized avatar

Sunil Kumar Sunilkumarr

  • Bengaluru, Karnataka
View GitHub Profile
/// A) First we will check the group is created or not. if group is created with booking id then we will launch the chat using AlGroupInformationAsyncTask from STEP 1
/// B) If the group is not exist we will create the group in onFailure of AlGroupInformationAsyncTask
/// C) In OnSuccess of group create callback of ALChannelCreateAsyncTask we will launch the group chat using STEP2
///
///
Step 1: Checking if group is created or not if created onSuccess will launch extsting group else we create a group in onFailure callback
AlGroupInformationAsyncTask.GroupMemberListener taskListener = new AlGroupInformationAsyncTask.GroupMemberListener() {
@Override
@Sunilkumarr
Sunilkumarr / gist:e5e90b45a0369dbdcc266b8673786ffb
Created March 3, 2020 15:20
Add this below activity in your app AndroidManifest.xml file
<activity
android:name="com.applozic.mobicomkit.uiwidgets.people.activity.MobiComKitPeopleActivity"
android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation"
android:label="@string/app_name"
android:parentActivityName="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"
android:theme="@style/ApplozicTheme"
android:windowSoftInputMode="adjustResize"
tools:node="replace">
<meta-data
@Sunilkumarr
Sunilkumarr / Logout method
Created January 23, 2020 11:36
Logout method
import Applozic
let registerUserClientService = ALRegisterUserClientService()
registerUserClientService.logout { (response, error) in
// Logout success error checking is not required
if(error != nil){
// NOTE: Logout failed if your using APNS then register the push notifcations again here .
@Sunilkumarr
Sunilkumarr / gist:04c4293d7cda131619a86f3796e2bfef
Last active January 22, 2020 13:53
Sample for unread count fetch for first time or next time
import Applozic
import Kommunicate
1) Use age for getting the unread count .
if KMUserDefaultHandler.isLoggedIn() {
// Check your user deafults as this method is called once if its called once then you can directly get the count from the method in else part
// Sample
@Sunilkumarr
Sunilkumarr / parent activity name of Conversation activity
Last active December 29, 2019 08:15
changing parent activity name of Conversation activity
--> Add this below code in your app androidmanifest file and change the `parentActivityName` it will be complete package name of the class
<activity
android:name="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"
android:configChanges="keyboardHidden|screenSize|locale|smallestScreenSize|screenLayout|orientation"
android:label="@string/app_name"
android:launchMode="singleTask"
android:parentActivityName="<parentActivityName>"
android:theme="@style/ApplozicTheme"
@Sunilkumarr
Sunilkumarr / gist:814a05f5f14357c21b4e01d356f357a4
Created December 9, 2019 17:11
Get user info and start the chat
public void startChatWithUserId(String userId, Context context) {
UserClientService userClientService = new UserClientService(context);
ContactDatabase contactDatabase = new ContactDatabase(context);
Contact contact = contactDatabase.getContactById(userId);
if (contact != null) {
Intent intent = new Intent(this, ConversationActivity.class);
intent.putExtra(ConversationUIService.USER_ID, userId);
@Sunilkumarr
Sunilkumarr / gist:5e03cf7585e7abf466c9eec569edb696
Created October 23, 2019 10:59
Checking user is in applozic or not
AppContactService appContactService = new AppContactService(this);
Contact contact = appContactService.getContactById("reciverUserIdhere");
if(contact.getLastSeenAt() != 0 ){
//Check from db if the last seen is there then user is there else will check from server
// User is registerd
}else{
// API call make it in async task
@Sunilkumarr
Sunilkumarr / gist:999e160268c255b33ff2819c135f9c54
Last active April 3, 2020 15:54
Starting the contact activity from different activity
1) For starting the contact activity use the below code
Intent intent = new Intent(this, MobiComKitPeopleActivity.class);
startActivityForResult(intent, ConversationUIService.REQUEST_CODE_CONTACT_GROUP_SELECTION);
1) Change the method for checking applozic notification or in place of AL_VALUE use this
let service = ALPushNotificationService()
if(service.isApplozicNotification(notification.request.content.userInfo)){
//applzoic notification
}else{
// YOur notiifcation
}
@Sunilkumarr
Sunilkumarr / gist:0909d199534796b906f25e544ef1c172
Last active September 3, 2019 12:41
Firebase with APNS applozic in native script
Do the changes in messaging.ios.js file
1)For registring APNS token to applozic server
Open the file messaging.ios.js and go to this line method name will be applicationDidRegisterForRemoteNotificationsWithDeviceToken
line number in ts file looks like this make sure you edit the change in .js file not in ts file
https://github.com/EddyVerbruggen/nativescript-plugin-firebase/blob/master/src/messaging/messaging.ios.ts#L159