pusher / chatkit-android Goto Github PK
View Code? Open in Web Editor NEWAndroid client SDK for Pusher Chatkit
Home Page: https://pusher.com/chatkit
License: MIT License
Android client SDK for Pusher Chatkit
Home Page: https://pusher.com/chatkit
License: MIT License
Hello. I use ChatManager.connect() method to recieve CurrentUser, but his avatarUrl always null. I checked server's response, and server returns correct json with avatarUrl. At class BaseSubscription after this
private val ResponseBody.messages: Sequence<Result<SubscriptionMessage<A>, Error>> get() = charStream().buffered().lineSequence() .map {line -> line.toSubscriptionMessage(messageParser) }
avatarUrl are lost.
For better pagination, api has to give when list is ended. so that app does not need to make api calls anymore
when user started typing , it triggers onUserStartedTyping
event, but when user stopped typing , its not triggering onUserStoppedTyping
event .Please check this
Hi. I have implemented pusher chatkit on IOS and android.
On android (kotlin) I connected to chat and receive the currentUser. Setup chat listener's.
That I observe that listeners works perfectly until I use currentUser.setReadCursor function.
After this it set the cursor but chat listener's don't fire anymore :(
Witch can be the issue? Can you check this.Thanks
Debuging into the code, when this is called...
private fun FormBody.Builder.add(map: Map<String, String>) = {
for ((k, v) in map) {
add(k, v)
}
}
...from...
private fun requestBody(tokenParams: Any?) = FormBody.Builder().apply {
add("grant_type", "client_credentials")
add(authData)
if (tokenParams is ChatkitTokenParams) add(tokenParams.extras)
}.build()
...it doesn't modify the FormBody
Am I the only one with this issue? Debug version works fine, but without proguard rules I cannot use this library in production. Can someone please help me with this?
When calling
currentUser.enablePushNotifications { result ->
when(result) {
is Result.Success -> Log.i("Success", "Push Notifications enabled")
else -> Log.e("Error", "Error starting Push Notifications")
}
}
As mentioned here in docs
Neither of the above messages are displayed in the log. So, basically callback function is not being called by the sdk. Please let me know if it is a bug with the sdk or I implemented it wrong.
After upgrading from 0.2.4 to 1.0.x (tried with both 1.0.3 and 1.0.5), currentUser.usersForRoom
does not return any users, even though pusher's dashboard clearly says there are 2 users on the requested room.
Sample code:
Working -> v.0.2.4.txt
Not Working -> v1.0.x.txt
I used this snippet to create a private room
val createRoomResult = currentUser.createRoom(privateRoomName,true,memberList).wait()
Turns out the room is actually not private. Is it only me, or ???
Room Connection Listener is not working when mobile network connection changes go to online-offline-online..
so messages,presence, typing status are not updating..
My App has two views. The first one is a Room List View. When app user clicks one of the rooms, a Chat View will be opened. I need to monitor the changes of unReadCount on the Room List View via a ChatListeners for every room.
Everything looks fine before I set a read cursor in the Chat view. The onRoomUpdated callback on in the ChatListerner will be fired when a messaging is coming, so I can get the latest unreadCount in it. Unfortunately, after I set a Read Cursor in the Chat View, the Chatlistener won't be triggered any more. I can confirm that the Read Cursor is set successfully because the value of unReadCount is changed when I restart the app.
Thank you.
sendMessage
is crashing throwing jni error exception,
How to create new users from chatkit-android sdk?
I am able to create new users by logging into the admin panel and creating new users manually. But I want to create a chat app, where user's can simply download my app, login via Google and the user is automatically created without anyone accessing the admin panel.
Kindly share an example that achieves this.
Some functions is missing in chatkit version 1.2.0 like
var cursorResult = currentUser.getReadCursor("lobby", otherUserId)
when (cursorResult) {
is Result.Success -> /* cursorResult.value... */
}
currentUser.subscribeToRoomMultipart(
roomId = "lobby",
listeners = RoomListeners(
onNewReadCursor = { cursor ->
// e.g. toast("User ${cursor.user.name} has read up to message ${cursor.position}")
}
),
callback = { /* ... */ }
)
You can find your library code from GitHub and check that function ..You can not find because it is not available . Please make proper document after proper release of your library .
my app has been crashed when tried to get/generate a token from my server. but, it only happens in the production server, when I tested on the local server it's going to be fine. here's below my error:
Fatal Exception: java.lang.RuntimeException: Unable to resume activity {houzcall.com.beautycall/houzcall.com.beautycall.activities.BottomNavigationActivity}: java.util.concurrent.ExecutionException: java.lang.NumberFormatException: null
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4039)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4071)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1970)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7156)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
Caused by java.util.concurrent.ExecutionException: java.lang.NumberFormatException: null
at java.util.concurrent.FutureTask.report(FutureTask.java:123)
at java.util.concurrent.FutureTask.get(FutureTask.java:193)
at com.pusher.platform.subscription.TokenProvidingSubscription.b(TokenProvidingSubscription.java:8)
at com.pusher.platform.subscription.TokenProvidingSubscription.<init>(TokenProvidingSubscription.java:50)
at com.pusher.platform.subscription.TokenProvidingSubscriptionKt$createTokenProvidingStrategy$1.a(TokenProvidingSubscriptionKt.java:25)
at com.pusher.platform.subscription.TokenProvidingSubscriptionKt$createTokenProvidingStrategy$1.a(TokenProvidingSubscriptionKt.java:4)
at com.pusher.platform.subscription.ResumingSubscription$OpeningSubscriptionState.<init>(ResumingSubscription.java:137)
at com.pusher.platform.subscription.ResumingSubscription.<init>(ResumingSubscription.java:54)
at com.pusher.platform.subscription.ResumingSubscriptionKt$createResumingStrategy$1.a(ResumingSubscriptionKt.java:25)
at com.pusher.platform.subscription.ResumingSubscriptionKt$createResumingStrategy$1.a(ResumingSubscriptionKt.java:4)
at com.pusher.platform.BaseClient.a(BaseClient.java:57)
at com.pusher.platform.Instance.a(Instance.java:45)
at com.pusher.platform.Instance.a(Instance.java:43)
at com.pusher.platform.Instance.a(Instance.java:71)
at com.pusher.chatkit.PlatformClient.a(PlatformClient.java:29)
at com.pusher.chatkit.subscription.LoggingSubscriptionKt.loggingSubscription(LoggingSubscriptionKt.java:49)
at com.pusher.chatkit.presence.PresenceService.goOnline(PresenceService.java:81)
at com.pusher.chatkit.presence.PresenceService.<init>(PresenceService.java:38)
at com.pusher.chatkit.SynchronousChatManager.<init>(SynchronousChatManager.java:199)
at com.pusher.chatkit.SynchronousChatManager.<init>(SynchronousChatManager.java:20)
at com.pusher.chatkit.ChatManager.<init>(ChatManager.java:20)
at houzcall.com.beautycall.core.ChatkitManager.a(ChatkitManager.java:40)
at houzcall.com.beautycall.core.App$ApplicationLifecycleHandler.onActivityResumed(App.java:76)
at android.app.Application.dispatchActivityResumed(Application.java:264)
at android.app.Activity.onResume(Activity.java:1398)
at androidx.fragment.app.FragmentActivity.onResume(FragmentActivity.java)
at houzcall.com.beautycall.activities.BottomNavigationActivity.onResume(BottomNavigationActivity.java)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1416)
at android.app.Activity.performResume(Activity.java:7612)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4031)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4071)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1970)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7156)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
Caused by java.lang.NumberFormatException: null
at java.lang.Long.parseLong(Long.java:557)
at java.lang.Long.parseLong(Long.java:636)
at com.pusher.chatkit.ChatkitTokenProvider.b(ChatkitTokenProvider.java:77)
at com.pusher.chatkit.ChatkitTokenProvider.access$getHttpUrl$p(ChatkitTokenProvider.java)
at com.pusher.chatkit.ChatkitTokenProvider$fetchTokenFromEndpoint$1.invoke(ChatkitTokenProvider.java:69)
at com.pusher.chatkit.ChatkitTokenProvider$fetchTokenFromEndpoint$1.invoke(ChatkitTokenProvider.java)
at com.pusher.platform.network.FuturesKt$sam$java_util_concurrent_Callable$0.call(FuturesKt.java:2)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
and this is my chatManager using production url:
chatManager = ChatManager(
instanceLocator = "~~~~~~",
userId = userID,
dependencies = AndroidChatkitDependencies(
tokenProvider = ChatkitTokenProvider(
endpoint = "https://~~~.co.id/api/pusher/generate-token",
userId = userID
),
context = context
)
)
and this is my local url:
chatManager = ChatManager(
instanceLocator = "~~~~~~",
userId = userID,
dependencies = AndroidChatkitDependencies(
tokenProvider = ChatkitTokenProvider(
endpoint = "http://~~~:8000/api/pusher/generate-token",
userId = userID
),
context = context
)
)
Android Studio V.3.6.1
Pusher chatkit-android V.1.9.0
Tested/Crashed on Android Devices API Level : 28 (Pie)
When I use ChatKit in a sample app, I always come across this error when the app could not connect to the internet. Even when I require the permission in my app, it still resurfaces.
2018-06-01 10:52:38.004 9218-9243/com.pusher.chatkitdemo E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
Process: com.pusher.chatkitdemo, PID: 9218
java.lang.SecurityException: ConnectivityService: Neither user 10081 nor current process has android.permission.ACCESS_NETWORK_STATE.
at android.os.Parcel.readException(Parcel.java:2004)
at android.os.Parcel.readException(Parcel.java:1950)
at android.net.IConnectivityManager$Stub$Proxy.getActiveNetworkInfo(IConnectivityManager.java:1195)
at android.net.ConnectivityManager.getActiveNetworkInfo(ConnectivityManager.java:786)
at com.pusher.platform.network.ConnectivityHelper.isConnected(ConnectivityHelper.kt:27)
at com.pusher.platform.network.ConnectivityHelper.onConnected(ConnectivityHelper.kt:33)
at com.pusher.platform.ErrorResolver.resolveError(ErrorResolver.kt:39)
at com.pusher.platform.subscription.ResumingSubscription$ResumingSubscriptionState.executeSubscriptionOnce(ResumingSubscription.kt:100)
at com.pusher.platform.subscription.ResumingSubscription$ResumingSubscriptionState.<init>(ResumingSubscription.kt:91)
at com.pusher.platform.subscription.ResumingSubscription$OpeningSubscriptionState$3.invoke(ResumingSubscription.kt:72)
at com.pusher.platform.subscription.ResumingSubscription$OpeningSubscriptionState$3.invoke(ResumingSubscription.kt:48)
at com.pusher.platform.subscription.TokenProvidingSubscription$FailedSubscriptionState.<init>(TokenProvidingSubscription.kt:105)
at com.pusher.platform.subscription.TokenProvidingSubscription$TokenProvidingState$fetchTokenAndExecuteSubscription$2.invoke(TokenProvidingSubscription.kt:86)
at com.pusher.platform.subscription.TokenProvidingSubscription$TokenProvidingState$fetchTokenAndExecuteSubscription$2.invoke(TokenProvidingSubscription.kt:40)
at com.pusher.chatkit.ChatkitTokenProvider$fetchTokenFromEndpoint$3.onFailure(ChatkitTokenProvider.kt:111)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:161)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
This sdk works for Pure Java? If not, there is a road map for it?
Since your latest chatkit android library version is 1.2.0 and your latest chatbeem library is 1.4.0 ..I can not build grade because chatkit library also contains push notifications code ..so getting duplicate class error in grade build .even enable Pushnotification in chatkit is not working .
Please make proper library before release .For Android your documention is not matching with your latest chatkit library 1.2.0 ..
For the first time when i try fetch , Direction.ORDER_FIRST fetch recent twenty messages and DIRECTION.NEWER_FIRST fetch last 20 items and if we specify it's working fine but need to reverse the list to get it done...
Gradle fails for v1.4.0 and v1.5.0 with this error
ERROR: Failed to resolve: chatkit-parent:pusher-platform-android:unspecified
For v1.3.4 gradle succeeds.
Could be related #43 ๐คทโโ
The connect works fine without the listeners. But once I uncomment the below code for listeners, the connect callback is never called. I tried to debug SDK code little bit, once the debugger reaches userSubscription.await()
it doens't go to next step. The same works fine if there are no listeners and goes to next line and proceeds with rest of code.
ckManager.connect(
// listeners = ChatListeners(
// onAddedToRoom = {room -> onCurrentUserAddedToRoom(room)}
// ),
callback = { result ->
when (result) {
is Result.Success -> {
ckCurrentUser = result.value
ckCurrentUser.enablePushNotifications { result ->
when (result) {
is Result.Success -> {
Log.d("Push Notifications", "Registered successfully")
}
is Error -> Log.e("Error", "Error starting Push Notifications")
}
}
}
is Result.Failure -> {
Log.d("Connection", "Can't connect to chatkit" + result.error)
}
}
}
)
https://search.maven.org/beta/artifact/com.pusher/chatkit-android/0.1.0/aar
Can you publish the latest artifacts? Im actually after chatkit-core
we had no troubles getting started with the iOS SDK which is great. however not so much luck with Android SDK.
We're on minSDKVersion 23 & targetSdkVersion 28. Android Studio 3.3.2. This is a Kotlin based Android app.
gradle entry
implementation 'com.pusher:chatkit-android:1.3.1'
Connecting is fine and works.
"currentUser" is defined as a class level var.
private lateinit var currentUser: CurrentUser
Subscribing seems to have API problems:
There a no methods available for "subscribeToRoomMultipart(...). Only "subscribeToRoom" shows up.
We tried the "subscribeToRoom" which compiled ok, but the error callback was returning this:-
Failed to extract required url params
This is our initialisation block:
chatManager = ChatManager(
instanceLocator = "v1:usxxxxxxxxxxxxxxx",
userId = "[email protected]",
dependencies = AndroidChatkitDependencies(
tokenProvider = ChatkitTokenProvider(
endpoint = "https://xxxxxxxxxxxxxx/token",
userId = "[email protected]"
)
)
)
Is something set incorrectly in the init function ?
Also just for reference following is the subscribeToRoom function:
currentUser.subscribeToRoom(
roomId = "comps",
listeners = RoomListeners(
onMessage = {
Log.i("CHAT234", "message is ${it.text}")
},
onMultipartMessage = {
Log.i("CHAT234", "message sender is ${it.sender.id}")
},
onUserStartedTyping = {
Log.i("CHAT234", "user started typing: ${it.id}")
},
onErrorOccurred = {
Log.i("CHAT234", "ERROR is ${it.reason}")
}
),
messageLimit = 20,
callback = {subscription ->
Log.i("CHAT234", "subscrip callback..")
Log.i("CHAT234", "is subscribed ? ${currentUser.isSubscribedToRoom("sogo_comps")}")
We couldn't really do much by this point so have raised this ticket. Appreciate if you can look at this.
I created my ChatKit server with Node.js to provide a token for my app. When I test my endpoint on postman, this is my response"
{
"status": 200,
"headers": {},
"body": {
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpbnN0YW5jZSI6ImQ1MzBkYjE4LTIwNzMtNDdmZS04OWQxLWJhZGY0MjRmMjlhNSIsImlzcyI6ImFwaV9rZXlzLzI4NzFhMTg2LTRlMjctNDc4Zi04NTU2LTQ2NGIzZTA4NjEyZiIsImlhdCI6MTUzOTIzMzI0MCwiZXhwIjoxNTM5MzE5NjQwfQ.N9SrQOzIRNMf0acti3ENfsfzytzP2Sfm60wLG83585I",
"expires_in": 86400,
"token_type": "bearer"
}
}
This presumes the server works perfectly.
However, the app throws an error:
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: java.util.concurrent.ExecutionException: java.lang.NumberFormatException: null
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at java.util.concurrent.FutureTask.report(FutureTask.java:94)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at java.util.concurrent.FutureTask.get(FutureTask.java:164)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.platform.network.FlatMapFuture.get(Futures.kt:71)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.platform.subscription.TokenProvidingSubscription.subscribe(TokenProvidingSubscription.kt:53)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.platform.subscription.TokenProvidingSubscription.<init>(TokenProvidingSubscription.kt:43)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.platform.subscription.TokenProvidingSubscriptionKt$createTokenProvidingStrategy$1.invoke(TokenProvidingSubscription.kt:19)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.platform.subscription.TokenProvidingSubscriptionKt$createTokenProvidingStrategy$1.invoke(TokenProvidingSubscription.kt)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.platform.subscription.ResumingSubscription$OpeningSubscriptionState.<init>(ResumingSubscription.kt:109)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.platform.subscription.ResumingSubscription.<init>(ResumingSubscription.kt:39)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.platform.subscription.ResumingSubscriptionKt$createResumingStrategy$1.invoke(ResumingSubscription.kt:18)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.platform.subscription.ResumingSubscriptionKt$createResumingStrategy$1.invoke(ResumingSubscription.kt)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.platform.BaseClient.subscribeResuming(BaseClient.kt:59)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.platform.Instance.subscribeResuming(Instance.kt:72)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.platform.Instance.subscribeResuming(Instance.kt:50)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.platform.Instance.subscribeResuming$default(Instance.kt:49)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.chatkit.ChatManager.subscribeResuming$chatkit_core(ChatManager.kt:155)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.chatkit.ChatManager.subscribeResuming$chatkit_core$default(ChatManager.kt:154)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.chatkit.users.UserSubscription.<init>(UserSubscription.kt:32)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.chatkit.ChatManager.openSubscription(ChatManager.kt:59)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.chatkit.ChatManager.connect(ChatManager.kt:55)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.chatkit.ChatManager.connect$default(ChatManager.kt:51)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.example.androidslackclone.MainActivity.connectChatKit(MainActivity.kt:76)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.example.androidslackclone.MainActivity.access$connectChatKit(MainActivity.kt:27)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.example.androidslackclone.MainActivity$getProfile$1$onSuccess$1.onSuccess(MainActivity.kt:124)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.example.androidslackclone.MainActivity$getProfile$1$onSuccess$1.onSuccess(MainActivity.kt:120)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.auth0.android.request.internal.BaseRequest.postOnSuccess(BaseRequest.java:92)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.auth0.android.request.internal.SimpleRequest.onResponse(SimpleRequest.java:76)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:177)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
2018-10-11 05:45:03.274 3199-3370/com.example.androidslackclone W/System.err: at java.lang.Thread.run(Thread.java:761)
2018-10-11 05:45:03.275 3199-3370/com.example.androidslackclone W/System.err: Caused by: java.lang.NumberFormatException: null
2018-10-11 05:45:03.275 3199-3370/com.example.androidslackclone W/System.err: at java.lang.Long.parseLong(Long.java:406)
2018-10-11 05:45:03.275 3199-3370/com.example.androidslackclone W/System.err: at java.lang.Long.parseLong(Long.java:485)
2018-10-11 05:45:03.275 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.chatkit.ChatkitTokenProvider.parseTokenResponse(ChatkitTokenProvider.kt:87)
2018-10-11 05:45:03.275 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.chatkit.ChatkitTokenProvider.access$parseTokenResponse(ChatkitTokenProvider.kt:23)
2018-10-11 05:45:03.275 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.chatkit.ChatkitTokenProvider$fetchTokenFromEndpoint$1$1.invoke(ChatkitTokenProvider.kt:54)
2018-10-11 05:45:03.275 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.chatkit.ChatkitTokenProvider$fetchTokenFromEndpoint$1$1.invoke(ChatkitTokenProvider.kt:23)
2018-10-11 05:45:03.275 3199-3370/com.example.androidslackclone W/System.err: at com.pusher.platform.network.FuturesKt$sam$java_util_concurrent_Callable$0.call(Futures.kt)
2018-10-11 05:45:03.275 3199-3370/com.example.androidslackclone W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
My understanding of this is that it is seeing the expires_in
value as null. This could be as a result of wrong parsing.
Please, can you look into it asap?
Functions such as userJoined
, userLeft
, userIsTyping
prove very helpful when building an interactive chat application especially when you show such extra details in the chat activity. Here in chatkit, such functions are only exposed in the UserSubscriptionsAdapter
which we only get when the chatManager
is connected. Definitely, we can't keep connecting the chatManager
in any activity where we need it.
I therefore propose, we have another interface that exposes such functions and then we can listen to them through the CurrentUser
.
java.lang.ArrayIndexOutOfBoundsException: length=10; index=10
at java.util.ArrayList.add(ArrayList.java:468)
at com.pusher.chatkit.ChatManager.subscribeResuming$chatkit_core(ChatManager.kt:160)
at com.pusher.chatkit.cursors.CursorService.createSubscription(CursorService.kt:72)
at com.pusher.chatkit.cursors.CursorService.subscribeForRoom(CursorService.kt:64)
at com.pusher.chatkit.rooms.RoomSubscription.<init>(RoomSubscription.kt:42)
at com.pusher.chatkit.rooms.RoomService.subscribeToRoom(RoomService.kt:79)
at com.pusher.chatkit.CurrentUser.subscribeToRoom(CurrentUser.kt:139)
at com.pusher.chatkit.CurrentUser.subscribeToRoom(CurrentUser.kt:123)
at wellthy.care.pusher.ApiPusherChatActivity$bind$1.doResume(ApiPusherChatActivity.kt:263)
at kotlin.coroutines.experimental.jvm.internal.CoroutineImpl.resume(CoroutineImpl.kt:54)
at kotlinx.coroutines.experimental.DispatchedTask$DefaultImpls.run(Dispatched.kt:161)
at kotlinx.coroutines.experimental.DispatchedContinuation.run(Dispatched.kt:25)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1412)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:285)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1152)
at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1990)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1938)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
These are the only two functions inside com.pusher.chatkit.CurrentUser that use Futures.schedule. Why?
fun setReadCursor(room: Room, position: Int) {
Futures.schedule { syncCurrentUser.setReadCursor(room.id, position) }
}
fun setReadCursor(roomId: String, position: Int) {
Futures.schedule { syncCurrentUser.setReadCursor(roomId, position) }
}
Hey guys,
This is what is there in the documentation to connect.
const val INSTANCE_LOCATOR = "v1:us1:80215247-1df3-4956-8ba8-9744ffd12161"
const val TOKEN_PROVIDER_ENDPOINT = "your.auth.url"
const val USER_ID = "sarah"
val chatManager = ChatManager(
instanceLocator = INSTANCE_LOCATOR,
userId = USER_ID,
dependencies = AndroidChatkitDependencies(
context = getApplicationContext(),
tokenProvider = ChatkitTokenProvider(TOKEN_PROVIDER_ENDPOINT, USER_ID)
)
)
But, it seems like ChatkitTokenProvider is expecting USER_ID as a map.
Best,
Kanoshka
I get online events but the offline ones don't seem to come through
This feels like an interface so why is it a data class?
I'm trying to get read cursor for some user for some roomId, which hasn't been previously set. And I'm receiveing error (Must be subscribed to room some_id to access member's read cursors) even if I have previously checked for room subscription. Is it not better to just return null in that case? Or I'm doing something wrong?
Caused by: OtherError(reason=Must be subscribed to room some_id to access member's read cursors, exception=null) at elements.Errors.other(errors.kt:42) at com.pusher.chatkit.cursors.CursorService.notSubscribedToRoom(CursorService.kt:66) at com.pusher.chatkit.cursors.CursorService.getReadCursor(CursorService.kt:63) at com.pusher.chatkit.SynchronousCurrentUser.getReadCursor(SynchronousCurrentUser.kt:56) at com.pusher.chatkit.CurrentUser.getReadCursor(CurrentUser.kt:61)
Hello, I'm trying to integrate Chatkit into my android app however I'm running into issues with a user who is already a member of the room, cannot subscribe to a room and am getting the error: D/ChatRoomsActivity:error.reason: Room membership required
The issue is also here on StackOverflow
This happens at the ChatRoomActivity
once a room as been clicked on from the ChatRoomListActivity
Here is the code block being used:
currentUser.subscribeToRoomMultipart(
roomId = roomId,
listeners = RoomListeners(
onMultipartMessage = { message ->
Log.d("TAG",message.toString())
runOnUiThread(Runnable{
adapter.addMessage(message)
recycler_view.layoutManager?.scrollToPosition(adapter.itemCount -1)
})
},
onErrorOccurred = { error ->
Log.d(AppActivityTags.chatRoomActivityTAG, "error.reason: " + error.reason)
}
),
messageLimit = 100, // Optional
callback = { subscription ->
// Called when the subscription has started.
// You should terminate the subscription with subscription.unsubscribe()
// when it is no longer needed
}
)
username is: username2-PCKid
here is a snippet of dashboard:
Also, although it says Room membership required
, I am somehow still able to add messages to the room? That is misleading.
Any and all help is appreciated!
Caused by java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: com.pusher.chatkit.ChatkitTokenProvider$add$1
at java.util.concurrent.FutureTask.report(FutureTask.java:94)
at java.util.concurrent.FutureTask.get(FutureTask.java:164)
at com.pusher.platform.network.FlatMapFuture.get(Futures.kt:71)
at com.pusher.platform.subscription.TokenProvidingSubscription.subscribe(TokenProvidingSubscription.kt:53)
at com.pusher.platform.subscription.TokenProvidingSubscription.(TokenProvidingSubscription.kt:43)
at com.pusher.platform.subscription.TokenProvidingSubscriptionKt$createTokenProvidingStrategy$1.invoke(TokenProvidingSubscription.kt:19)
at com.pusher.platform.subscription.TokenProvidingSubscriptionKt$createTokenProvidingStrategy$1.invoke(TokenProvidingSubscription.kt)
at com.pusher.platform.subscription.ResumingSubscription$OpeningSubscriptionState.(ResumingSubscription.kt:109)
at com.pusher.platform.subscription.ResumingSubscription.(ResumingSubscription.kt:39)
at com.pusher.platform.subscription.ResumingSubscriptionKt$createResumingStrategy$1.invoke(ResumingSubscription.kt:18)
at com.pusher.platform.subscription.ResumingSubscriptionKt$createResumingStrategy$1.invoke(ResumingSubscription.kt)
at com.pusher.platform.BaseClient.subscribeResuming(BaseClient.kt:59)
at com.pusher.platform.Instance.subscribeResuming(Instance.kt:72)
at com.pusher.platform.Instance.subscribeResuming(Instance.kt:50)
at com.pusher.platform.Instance.subscribeResuming$default(Instance.kt:49)
at com.pusher.chatkit.ChatManager.subscribeResuming$chatkit_core(ChatManager.kt:155)
at com.pusher.chatkit.ChatManager.subscribeResuming$chatkit_core$default(ChatManager.kt:154)
at com.pusher.chatkit.users.UserSubscription.(UserSubscription.kt:32)
at com.pusher.chatkit.ChatManager.openSubscription(ChatManager.kt:59)
at com.pusher.chatkit.ChatManager.connect(ChatManager.kt:55)
at com.pusher.chatkit.ChatManager.connect(ChatManager.kt:86)
at wellthy.care.pusher.PusherChat.connect(PusherChat.kt:94)
at wellthy.care.feature.onboarding.phone.PhoneVerificationActivity$navigateUserToMainFlow$1.onComplete(PhoneVerificationActivity.kt:234)
at com.google.android.gms.tasks.zzf.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5461)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Hi,
When I have chat between two clients, I can get only the first new message, after that all other new messages are not coming to the target client,
my code:
subscription = ChatkitManager.getInstance().getUserManager().subscribeToRoom(roomID, new Function1<RoomSubscriptionEvent, Unit>() {
@Override
public Unit invoke(final RoomSubscriptionEvent roomSubscriptionEvent) {
if(roomSubscriptionEvent instanceof RoomSubscriptionEvent.NewMessage){
//handle message
}
(URL(message.attachment.link).query?.split("&") ?: emptyList())
leads to an error like s3:// malformed URL
when fetching messages
Are there plans to support editing of messages in future? Or can I just submit a PR for that?
Right now, it's taking whatever version the app is taking (see below link). It should instead take the version of the Chatkit SDK from the file releases.
Cloned the repo and it doesn't even build. I get this error:
Gradle sync failed: 'Gradle: net.bytebuddy:byte-buddy-agent:1.7.4@jar' already disposed
Any help fixing it? Thanks!
i add the dependency as explained in the ReadMe
my gradle keeps crashing and i keep getting the same errors
it seems to search everywhere including the maven repositories but cant find the files
Error:Could not resolve all files for configuration ':app:debugCompileClasspath'.
Could not find com.pusher:chatkit-android:$chatkit-version.
Searched in the following locations:
file:/opt/google/android-sdk/extras/m2repository/com/pusher/chatkit-android/$chatkit-version/chatkit-android-$chatkit-version.pom
file:/opt/google/android-sdk/extras/m2repository/com/pusher/chatkit-android/$chatkit-version/chatkit-android-$chatkit-version.jar
file:/opt/google/android-sdk/extras/google/m2repository/com/pusher/chatkit-android/$chatkit-version/chatkit-android-$chatkit-version.pom
file:/opt/google/android-sdk/extras/google/m2repository/com/pusher/chatkit-android/$chatkit-version/chatkit-android-$chatkit-version.jar
file:/opt/google/android-sdk/extras/android/m2repository/com/pusher/chatkit-android/$chatkit-version/chatkit-android-$chatkit-version.pom
file:/opt/google/android-sdk/extras/android/m2repository/com/pusher/chatkit-android/$chatkit-version/chatkit-android-$chatkit-version.jar
file:/opt/google/android-studio/gradle/m2repository/com/pusher/chatkit-android/$chatkit-version/chatkit-android-$chatkit-version.pom
file:/opt/google/android-studio/gradle/m2repository/com/pusher/chatkit-android/$chatkit-version/chatkit-android-$chatkit-version.jar
https://dl.google.com/dl/android/maven2/com/pusher/chatkit-android/$chatkit-version/chatkit-android-$chatkit-version.pom
https://dl.google.com/dl/android/maven2/com/pusher/chatkit-android/$chatkit-version/chatkit-android-$chatkit-version.jar
https://jcenter.bintray.com/com/pusher/chatkit-android/$chatkit-version/chatkit-android-$chatkit-version.pom
https://jcenter.bintray.com/com/pusher/chatkit-android/$chatkit-version/chatkit-android-$chatkit-version.jar
Required by:
project :app
These are my dependencies:
dependencies {
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-v4:27.1.1'
compile 'com.android.support:gridlayout-v7:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
compile 'com.android.support:design:27.1.1'
compile 'com.android.support:cardview-v7:27.1.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
implementation 'com.pusher:chatkit-android:$chatkit-version'
}
UI features like
Are these features part of the chat kit or do we need to build these features on our own?
In chatkit-swift
on first subscription to room listeners by default it will retrieve the other users in the room (disregarding the currentUser) however in chatkit-android
when i subscribe the onPresenceChange
callback throws the same user (currentUser) who is the subscriber. I should receive the other users in this case.
Here is a snippet for my code
currentUser?.subscribeToRoomMultipart( roomId, RoomListeners( onPresenceChange = { user -> // >>>>>> here i receive same user that i am already subscribing with :: i expect to receive the other users } ), messageLimit = 0, callback = { subscription -> disposableSubscription.add(subscription) })
In case that this is intended behaviour, can u please tell alternative way to get the other users on onPresenceChange
or chat subscription ?
currentUser.fetchMessages(
room = someRoom,
initialId = 42, // Optional
direction = NEWER_FIRST, // Optional, OLDER_FIRST by default
limit = 20 // Optional, 10 by default
).wait().let { result ->
when(result) { // Result<List, Error>
is Result.Success -> toast("Mesages ${result.value} received.")
is Result.Failure -> toast("Oops, something bad happened: ${result.error}")
}
}
i was trying to use Fetch Messages , it was not showing the latest build 0.10.0. can you please update the version?
when i try to fetch first time i use this fuction
fetchMessages(roomId=roomId,direction = Direction.ORDER_FIRST,limit = 20)
and i am listing the id here
05-16 18:32:02.778 26511-27514/1g 1: message item id first time: 1532585 and text fourty
05-16 18:32:02.778 26511-27514/1g 1: message item id first time: 1532584 and text thity nine
05-16 18:32:02.778 26511-27514/1g 1: message item id first time: 1532581 and text thirty six
05-16 18:32:02.778 26511-27514/1g 1: message item id first time: 1532577 and text thirty five
05-16 18:32:02.778 26511-27514/1g 1: message item id first time: 1532575 and text 34
05-16 18:32:02.778 26511-27514/1g 1: message item id first time: 1532574 and text 33
05-16 18:32:02.778 26511-27514/1g 1: message item id first time: 1532573 and text 32
05-16 18:32:02.778 26511-27514/1g 1: message item id first time: 1532571 and text 31
05-16 18:32:02.778 26511-27514/1g 1: message item id first time: 1532569 and text 30
05-16 18:32:02.779 26511-27514/1g 1: message item id first time: 1532568 and text 29
05-16 18:32:02.779 26511-27514/1g 1: message item id first time: 1532567 and text 28
05-16 18:32:02.779 26511-27514/1g 1: message item id first time: 1532566 and text 27
05-16 18:32:02.779 26511-27514/1g 1: message item id first time: 1532563 and text 26
05-16 18:32:02.779 26511-27514/1g 1: message item id first time: 1532562 and text 25
05-16 18:32:02.779 26511-27514/1g 1: message item id first time: 1532561 and text 24
05-16 18:32:02.779 26511-27514/1g 1: message item id first time: 1532560 and text 23
05-16 18:32:02.779 26511-27514/1g 1: message item id first time: 1532559 and text 22
05-16 18:32:02.779 26511-27514/1g 1: message item id first time: 1532558 and text 21
05-16 18:32:02.779 26511-27514/g 1: message item id first time: 1532557 and text 20
05-16 18:32:02.779 26511-27514/1g 1: message item id first time: 1532556 and text 19
and next time i am trying to fetch i am using this
fetchMessages(roomId=room!!.id,initialId = messageItemlast.id,direction = Direction.NEWER_FIRST,limit = 20)
05-16 18:42:54.218 32350-32350/1 id for loop inside load more : 1532514 and text vhj
05-16 18:42:54.218 32350-32350/1 id for loop inside load more : 1532535 and text second
05-16 18:42:54.218 32350-32350/1 id for loop inside load more : 1532536 and text third
05-16 18:42:54.218 32350-32350/1 id for loop inside load more : 1532537 and text fourth
05-16 18:42:54.219 32350-32350/1 id for loop inside load more : 1532538 and text fifith
05-16 18:42:54.219 32350-32350/1 id for loop inside load more : 1532539 and text second
05-16 18:42:54.219 32350-32350/1 id for loop inside load more : 1532542 and text seventh
05-16 18:42:54.219 32350-32350/1 id for loop inside load more : 1532543 and text eight
05-16 18:42:54.219 32350-32350/1 id for loop inside load more : 1532544 and text nine
05-16 18:42:54.220 32350-32350/1 id for loop inside load more : 1532545 and text ten
05-16 18:42:54.220 32350-32350/1 id for loop inside load more : 1532546 and text 11
05-16 18:42:54.220 32350-32350/1 id for loop inside load more : 1532547 and text 12
05-16 18:42:54.220 32350-32350/1 id for loop inside load more : 1532548 and text thirteen
05-16 18:42:54.220 32350-32350/1 id for loop inside load more : 1532549 and text fourteen
05-16 18:42:54.220 32350-32350/1 id for loop inside load more : 1532550 and text fifteen
05-16 18:42:54.221 32350-32350/1 id for loop inside load more : 1532551 and text sixteen
05-16 18:42:54.221 32350-32350/1 id for loop inside load more : 1532553 and text 17
05-16 18:42:54.221 32350-32350/1 id for loop inside load more : 1532555 and text 18
05-16 18:42:54.221 32350-32350/1 id for loop inside load more : 1532556 and text 19
05-16 18:42:54.221 32350-32350/1 id for loop inside load more : 1532557 and text 20
as you could see the message id 1532557,1532556 should not be fetched..
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.