Skip to content

Instantly share code, notes, and snippets.

View Sunilkumarr's full-sized avatar

Sunil Kumar Sunilkumarr

  • Bengaluru, Karnataka
View GitHub Profile
@Sunilkumarr
Sunilkumarr / Recent chat message details
Last active May 18, 2021 14:14
Recent chat message or latest message details for group or one to one
ALChannelService * channelService = [[ALChannelService alloc] init
];
ALContactDBService * contactDBService = [[ALContactDBService alloc] init];
[applozicClient getLatestMessages:NO withCompletionHandler:^(NSMutableArray *messageList, NSError *error) {
if(!error){
for (ALMessage *message in messageList) {
/// Message text
NSLog(@"Recent message text %@", message.message);
@Sunilkumarr
Sunilkumarr / gist:f971f1433846bf2c4dedc797bab48eaf
Last active April 19, 2021 10:20
Custom back button in one to one or group chat
1. Find the method launchChatWith(contactId in ALChatmanager.swift file and replace it with below code for adding custom back button
func launchChatWith(contactId: String, from viewController: UIViewController, configuration: ALKConfiguration, prefilledMessage: String? = nil) {
let alContactDbService = ALContactDBService()
var title = ""
if let alContact = alContactDbService.loadContact(byKey: "userId", value: contactId), let name = alContact.getDisplayName() {
title = name
@Sunilkumarr
Sunilkumarr / gist:6d5628e580012738e6c68918ee83f888
Created November 30, 2020 18:22
Notification observer for iOS and local broadcast for android. in native script
/*
In NativeScript, the app.js file is the entry point to your application.
You can use this file to perform app-level initialization, but the primary
purpose of the file is to pass control to the app’s first module.
*/
/*
Do not place any code after the application has been started as it will not
be executed on iOS.
@Sunilkumarr
Sunilkumarr / app.ts or main.ts
Created October 27, 2020 10:43
app.ts for activate or deactivate NS7
/*
In NativeScript, the app.ts file is the entry point to your application.
You can use this file to perform app-level initialization, but the primary
purpose of the file is to pass control to the app’s first module.
*/
import { Application, Utils } from '@nativescript/core';
/// START APPLOZIC NativeScript
@Sunilkumarr
Sunilkumarr / native-script-js-ts-app-main
Created October 27, 2020 10:41
app.js for activate and deactivate callbacks
/*
In NativeScript, the app.js file is the entry point to your application.
You can use this file to perform app-level initialization, but the primary
purpose of the file is to pass control to the app’s first module.
*/
/// START APPLOZIC NativeScript
const { Application} = require("@nativescript/core");
const { Utils} = require("@nativescript/core");
@Sunilkumarr
Sunilkumarr / gist:a794a394902ae33942a803ddeab9f4e4
Last active September 30, 2020 11:12
User details API call for checking if user exist or not.
NOTE: Call this below API in ASYNC task or any other as this is server call.
CODE :
UserClientService userClientService = new UserClientService(MainActivity.this);
Set<String> userIds = new HashSet<>();
userIds.add("<RECIVER-USER-ID>"); // PASS the userID :
String response = userClientService.getUserDetails(userIds);
Log.i("USER", "The Response is :" + response);
if (TextUtils.isEmpty(response) || !TextUtils.isEmpty(response) && response.equals("error")) {
@Sunilkumarr
Sunilkumarr / gist:9bae90b33c702b59be281edd7ec7f090
Created September 15, 2020 10:05
Steps for generating xcframework for applozic
1. Select Applozic.xcodeproj and Click TARGET Applozic and go to Build settings search Build libraries for Distribution and make it to YES
2. In same TARGET Applozic go to Build settings search Skip install and make it to NO
3. Go to cd /Applozic-iOS-SDK/sample-with-framework in terminal and execute the below command from A to C one by one by copy pasting it in terminal one by one wait for one command to complete
A) xcodebuild archive -scheme Applozic -archivePath archives/ios -sdk iphoneos SKIP_INSTALL=NO
B) xcodebuild archive -scheme Applozic -archivePath archives/ios-sim -configuration Debug -sdk iphonesimulator SKIP_INSTALL=NO
@Sunilkumarr
Sunilkumarr / gist:8064a64125b3770e0260ff4ca0f8c742
Last active August 13, 2020 13:37
Get registered users details
1.Add this code in your class
import Applozic
/// Fetchs the contact from local db
func fetchContactsFromDB() -> [ALContact] {
let dbHandler = ALDBHandler.sharedInstance()
let fetchReq = NSFetchRequest<DB_CONTACT>(entityName: "DB_CONTACT")
var predicate = NSPredicate()
@Sunilkumarr
Sunilkumarr / gist:eb1548010ed920cc97d9ee4ec145aa54
Last active August 3, 2020 18:41
Push notification for react native android applozic v5.5.6
1.Add the MyFCMService.java attached file in your project by download that and drag and drop in your android project under package app> main> java >in your packge folder
NOTE: make sure that the MyFCMService.java as your package name in place of package com.myapp.pushnotification;
2.Addd this in your android manifest file
in RNFirebaseMessagingService.java
<service
@Sunilkumarr
Sunilkumarr / gist:d154df7567ea3b9f6377a61c84a49909
Last active July 27, 2020 09:06
Overriding firebase react native messaging and adding applozic push notification
1.Add the RNFirebaseMessagingService.java attached file in your project by download that and drag and drop in your android manifest under your app> main> java >in your packge folder
NOTE: make sure that the RNFirebaseMessagingService.jav as your package name in place of package com.mysamplereact;
in RNFirebaseMessagingService.java
2.Addd this in your android manifest file
<service
android:name=".RNFirebaseMessagingService"
android:exported="false"