chat-sdk / docs Goto Github PK
View Code? Open in Web Editor NEWChat SDK Documentation
Chat SDK Documentation
I already set up chat sdk with test root path which creates child node, but I want to save in the root node of the database instead of the test root path. I noticed that if I remove root path at info.plist, my app crashed.
i have problem with implement chatsdk in my existing project. i try this documentation -> https://chatsdk.co/docs/android-quickstart/ but in step add to gradle, i got error like this.
AGPBI: {"kind":"error","text":"error: resource android:attr/ttcIndex not found.","sources":[{"file":"/Users/muhwid/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.0.aar/35c2e1d7328226ef85a2fdd8d20e7d76/res/values/values.xml","position":{"startLine":250,"startColumn":4,"startOffset":27058,"endColumn":68,"endOffset":27122}}],"original":"","tool":"AAPT"}
:app:processDebugResources
:app:processDebugResources FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
Failed to process resources, see aapt output above for details.
please help me with this issue
I am using following method :
List users = ChatSDK.contact().contacts();
i want to show list of all users in app . i have 8 users on my firebase user's list .But this method is returning empty array .
How can we host the chat SDK on our own server? Is there any documentation regarding that?
Hi, I love your SDK but I've problems storing the contacts, I'm in android.
This is my code.
public void insertContact(String userID, SilentResponseListener success, SilentResponseListener failure)
{
UserWrapper wrapper = UserWrapper.initWithEntityId(userID);
wrapper.metaOn();
wrapper.onlineOn();
User user = wrapper.getModel();
String currentUserID = NMWrapper.auth(mContext).getCurrentUserEntityID(); // this is for initializing the chatSDK if is not yet initialized
if (currentUserID == null)
{
AuthService.getInstance(mContext).logOut();
}
Disposable disposable = NM.contact().addContact(user, ConnectionType.Contact).subscribe(new Action() {
@Override
public void run() {
Log.d("success","supa success");
success.run();
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
throwable.printStackTrace();
Log.d("This is failure",throwable.getMessage());
failure.run();
}
});
}
And I've been debugging and the user
is retrieved successfully and my user is logged in, but every time I ask for the contacts i.e. NM.contact().contacts()
the list is empty!
And don't know what I'm doing wrong.
EDIT
Also, the success function is always called
EDIT2
Stop your horses!!! I see what is the problem, the name of the contact can't be null and I was leaving the name null because the name is the same as the ID.
I have added this code in onCreate() but the listener is not fired. Can you please help?
I am using ChatSDK Android 4.8.18.
This listener is only called once when I enter the activity.
Disposable d = ChatSDK.events().sourceOnMain()
.filter(NetworkEvent.filterType(EventType.MessageAdded))
.filter(NetworkEvent.filterThreadEntityID(thread.getName()))
.subscribe(new Consumer<NetworkEvent>() {
@Override
public void accept(NetworkEvent networkEvent) throws Exception {
txtBadgeCount.setText(String.valueOf(thread.getUnreadMessagesCount()));
}
});
Should fix this way:
-AccountDetails details = new AccountDetails.token("Your token");
+AccountDetails details = AccountDetails.token("Your token");
To keep doc more clear i think it will be better to update those lines too:
-AccountDetails details = username("[email protected]", "some password");
+AccountDetails details = AccountDetails.username("[email protected]", "some password");
-AccountDetails details = signUp("Joe", "Joe123");
+AccountDetails details = AccountDetails.signUp("Joe", "Joe123");
In the docs I found a method ChatSdk.addCustomMessageHandler()
But it doesn't exists actually, Please help me find a resolution.
Normally I can send text message to tread by
[NM.core sendMessageWithText:@"Some text" withThreadEntityID:thread.entityID];
but in my progect I want to make custom cell for layout massage basic on info in text field of message
in this case I should set message to bMessageTypeCustom
how in Docs example:
id<PMessage> message = [[BStorageManager sharedManager].a createEntity:bMessageEntity];
message.type = @(bMessageTypeCustom);
[message setText:[NSString stringWithString:@"MyIdentifierText-CodeForCustomCellInitiation"]];
then I got method for send message
[NM.core sendMessage:message];
but I can't set message tread
in documentation ic next:
// Use thread setMessage instead
//-(void) setThread: (id<PThread>) thread;
-(id<PThread>) thread;
method sendThread
is commented and it noted to use setMessage
method that is absent in ChatSDK
How to send message with bMessageTypeCustom. ???
I want to integrate chat sdk into an existing app that already has firebase users. How do I synchronize existing firebase users with chat sdk user database? This code User currentUser = ChatSDK.core().currentUser();
returns null.
Hi, I was thinking if there is a way of creating a thread for only two users only if doesn't exist one previously.
The other possibility is to loop through the thread and see if it doesn't exist previously.
I unable to find, how can I show unread messages badge on button which open ChatActivity.
Hi,
My project is already setup with firebase and I want to add Chat SDK.
I am using custom login so I setup the ChatSDK in app delegate according to documents. My code is as under.
let config = BConfiguration.init();
config.rootPath = "test"
// Configure other options here...
config.allowUsersToCreatePublicChats = true
BChatSDK.initialize(config, app: application, options: launchOptions)
After that I am login to the firebase and ChatSDK as under
BIntegrationHelper.authenticate(withToken: Auth.auth().currentUser?.refreshToken)
BIntegrationHelper.updateUser(withName: userName, image: nil, url: nil)
I observed that there is no database entry in firebase after login so I implemented following method.
_ = BChatSDK.core()?.pushUser()?.thenOnMain({ thread in
// Success
return nil
}, { error in
// Failure
print(error.debugDescription)
return error
})
I am getting error in above case and no database entries on Firebase.
I am opening chatviewcontroller on button click as Under
let wrapper2 : CCUserWrapper = CCUserWrapper.user(withEntityID: selectedID)
wrapper2.metaOn()
// wrapper2.onlineOn()
let user2 : PUser = wrapper2.model()
if (selectedName.count > 0 )
{
user2.setName(selectedName)
}
else
{
user2.setName("No name set")
}
wrapper2.push() //database entry in users table but not on indices
// BChatSDK.contact().addContact(user2, with: bUserConnectionTypeContact)
let wrapper1 : CCUserWrapper = CCUserWrapper.user(withEntityID: myID
)
wrapper1.metaOn()
wrapper1.onlineOn()
let user1 : PUser = wrapper1.model()
if (myName.count > 0 )
{
user1.setName(myName)
}
else
{
user1.setName("No name set")
}
wrapper1.push() // This push creates database users entry but not in indices.
let users : Array = [user1, user2]
_ = BChatSDK.core().createThread(withUsers: users , threadCreated: {(error: Error?, thread:PThread?) in
if ((error) != nil)
{
print(error.debugDescription)
}
else
{
let cvc = BChatSDK.ui().chatViewController(with: thread)
self.navigationController?.pushViewController(cvc!, animated: true)
}
}) }
My app crashed in above case.
Stack trace is as under
018-11-30 03:41:31.296060+0500 ModoBuddy[73840:7171000] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(
0 CoreFoundation 0x00000001094ea1bb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x0000000108a84735 objc_exception_throw + 48
2 CoreFoundation 0x00000001094364ec _CFThrowFormattedException + 194
3 CoreFoundation 0x0000000109412775 -[__NSArrayM insertObject:atIndex:] + 1269
4 ChatSDK 0x00000001059d5893 -[BAbstractCoreHandler fetchThreadWithUsers:] + 211
5 ModoBuddy 0x0000000103b06b3c -[BFirebaseCoreHandler createThreadWithUsers:name:threadCreated:] + 140
6 ModoBuddy 0x0000000103b071ec -[BFirebaseCoreHandler createThreadWithUsers:threadCreated:] + 124
7 ModoBuddy 0x0000000103a72342 $S9ModoBuddy28FriendsProfileViewControllerC10actMessageyyypF + 2466
8 ModoBuddy 0x0000000103a729cc $S9ModoBuddy28FriendsProfileViewControllerC10actMessageyyypFTo + 76
9 UIKitCore 0x000000010d87aecb -[UIApplication sendAction:to:from:forEvent:] + 83
10 UIKitCore 0x000000010d2b60bd -[UIControl sendAction:to:forEvent:] + 67
11 UIKitCore 0x000000010d2b63da -[UIControl _sendActionsForEvents:withEvent:] + 450
12 UIKitCore 0x000000010d2b531e -[UIControl touchesEnded:withEvent:] + 583
13 UIKitCore 0x000000010d8b60a4 -[UIWindow _sendTouchesForEvent:] + 2729
14 UIKitCore 0x000000010d8b77a0 -[UIWindow sendEvent:] + 4080
15 UIKitCore 0x000000010d895394 -[UIApplication sendEvent:] + 352
16 UIKit 0x000000012a1b6183 -[UIApplicationAccessibility sendEvent:] + 85
17 UIKitCore 0x000000010d96a5a9 __dispatchPreprocessedEventFromEventQueue + 3054
18 UIKitCore 0x000000010d96d1cb __handleEventQueueInternal + 5948
19 CoreFoundation 0x000000010944f721 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
20 CoreFoundation 0x000000010944ef93 __CFRunLoopDoSources0 + 243
21 CoreFoundation 0x000000010944963f __CFRunLoopRun + 1263
22 CoreFoundation 0x0000000109448e11 CFRunLoopRunSpecific + 625
23 GraphicsServices 0x0000000110e2b1dd GSEventRunModal + 62
24 UIKitCore 0x000000010d87981d UIApplicationMain + 140
25 ModoBuddy 0x0000000103ada7c4 main + 68
26 libdyld.dylib 0x000000010abed575 start + 1
27 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Kindly help me out
thanks
i am implementing the chatsdk into a custom application where i need the chat functionality on a page that is playing the live stream.
one half of the page will have the chat functionality and the other half will stream the video. there are no options for implementing such functionality in your current SDK. how do i implement it.
(updated to latest sdk)
The steps in the documentation are:
AccountDetails details = new AccountDetails.token("Token");
NM.auth().authenticate(details).subscribe();
When the second line executes, there is an immediate exception that complains about the token format which is in the documentation but there is no documentation about the token format.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.karmist.austin, PID: 7083
io.reactivex.exceptions.OnErrorNotImplementedException: The custom token format is incorrect. Please check the documentation.
at io.reactivex.internal.observers.EmptyCompletableObserver.onError(EmptyCompletableObserver.java:51)
at io.reactivex.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.onError(CompletableSubscribeOn.java:74)
at io.reactivex.internal.operators.completable.CompletablePeek$CompletableObserverImplementation.onError(CompletablePeek.java:96)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onError(SingleFlatMapCompletable.java:97)
at io.reactivex.internal.operators.single.SingleCreate$Emitter.tryOnError(SingleCreate.java:95)
at io.reactivex.internal.operators.single.SingleCreate$Emitter.onError(SingleCreate.java:81)
at co.chatsdk.firebase.FirebaseAuthenticationHandler$6$1.onComplete(FirebaseAuthenticationHandler.java:102)
at com.google.android.gms.tasks.zzf.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
Caused by: com.google.firebase.auth.FirebaseAuthInvalidCredentialsException: The custom token format is incorrect. Please check the documentation.
at com.google.android.gms.internal.zzdkj.zzak(Unknown Source)
at com.google.android.gms.internal.zzdjl.zza(Unknown Source)
at com.google.android.gms.internal.zzdku.zzal(Unknown Source)
at com.google.android.gms.internal.zzdkw.onFailure(Unknown Source)
at com.google.android.gms.internal.zzdkl.onTransact(Unknown Source)
at android.os.Binder.execTransact(Binder.java:565)
When one follows the directions for the username/password scenario there is an immediate exception
AccountDetails details = AccountDetails.username("Joe", "Joe123");
NM.auth().authenticate(details).subscribe();
E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.karmist.austin, PID: 2130
io.reactivex.exceptions.OnErrorNotImplementedException: The email address is badly formatted.
at io.reactivex.internal.observers.EmptyCompletableObserver.onError(EmptyCompletableObserver.java:51)
at io.reactivex.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.onError(CompletableSubscribeOn.java:74)
at io.reactivex.internal.operators.completable.CompletablePeek$CompletableObserverImplementation.onError(CompletablePeek.java:96)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onError(SingleFlatMapCompletable.java:97)
at io.reactivex.internal.operators.single.SingleCreate$Emitter.tryOnError(SingleCreate.java:95)
at io.reactivex.internal.operators.single.SingleCreate$Emitter.onError(SingleCreate.java:81)
at co.chatsdk.firebase.FirebaseAuthenticationHandler$6$1.onComplete(FirebaseAuthenticationHandler.java:102)
at com.google.android.gms.tasks.zzf.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
Caused by: com.google.firebase.auth.FirebaseAuthInvalidCredentialsException: The email address is badly formatted.
at com.google.android.gms.internal.zzdkj.zzak(Unknown Source)
at com.google.android.gms.internal.zzdjl.zza(Unknown Source)
at com.google.android.gms.internal.zzdku.zzal(Unknown Source)
at com.google.android.gms.internal.zzdkw.onFailure(Unknown Source)
at com.google.android.gms.internal.zzdkl.onTransact(Unknown Source)
at android.os.Binder.execTransact(Binder.java:565)
Is there a step missing or could I possibly have misconfigured something? Neither user in the above cases shows up in firebase.
when I try signup
AccountDetails details = AccountDetails.signUp("Joe", "Joe123");
NM.auth().authenticate(details).subscribe();
there is an email exception
E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.karmist.austin, PID: 5129
io.reactivex.exceptions.OnErrorNotImplementedException: The email address is badly formatted.
at io.reactivex.internal.observers.EmptyCompletableObserver.onError(EmptyCompletableObserver.java:51)
at io.reactivex.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.onError(CompletableSubscribeOn.java:74)
at io.reactivex.internal.operators.completable.CompletablePeek$CompletableObserverImplementation.onError(CompletablePeek.java:96)
at io.reactivex.internal.operators.single.SingleFlatMapCompletable$FlatMapCompletableObserver.onError(SingleFlatMapCompletable.java:97)
at io.reactivex.internal.operators.single.SingleCreate$Emitter.tryOnError(SingleCreate.java:95)
at io.reactivex.internal.operators.single.SingleCreate$Emitter.onError(SingleCreate.java:81)
at co.chatsdk.firebase.FirebaseAuthenticationHandler$6$1.onComplete(FirebaseAuthenticationHandler.java:102)
at com.google.android.gms.tasks.zzf.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
Caused by: com.google.firebase.auth.FirebaseAuthInvalidCredentialsException: The email address is badly formatted.
at com.google.android.gms.internal.zzdkj.zzak(Unknown Source)
at com.google.android.gms.internal.zzdjl.zza(Unknown Source)
at com.google.android.gms.internal.zzdku.zzal(Unknown Source)
at com.google.android.gms.internal.zzdkw.onFailure(Unknown Source)
at com.google.android.gms.internal.zzdkl.onTransact(Unknown Source)
at android.os.Binder.execTransact(Binder.java:565)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.