Viet Nhan Nghi Tran • almost 11 years ago
invite user to private channel
I have an error when try to invite user to private channel - forum.
Please see my description about this error. Please advise. Thanks
https://docs.google.com/document/d/1VliIMBpCOjzIoAbYWejDS0g0n7GWAYcfhiz8iV6bjE4/edit?usp=sharing
Comments are closed.

16 comments
Shannph Wong Manager • almost 11 years ago
First of all, thanks for your participation in this hackathon. I've noticed a couple of things that you're missing here.
When working in Magnet Message, you need to really understand that you're working in the context of a user. Every message you send must come from a user and is sent to another user.
In the code snippet that you've attached, it appears that you've created the user object, but you haven't gone through the steps of actually registering the user - which is necessary so that our backend server can identify the user - and then you must login as that user.
Until you go through the steps of registration and login, all subsequent calls will fail.
Take a look at this page: https://docs.magnet.com/message/android/creating-your-first-app-android/
It should walk you through these steps more clearly.
Now, this is good feedback for us so that we can get clearer in our error messages and error handling.
Viet Nhan Nghi Tran • almost 11 years ago
I already followed all steps of https://docs.magnet.com/message/android/creating-your-first-app-android/
In my test, I did log in and try to invite user but unsuccessfully invited. I documented this error here. Please have a look. Thank you.
https://docs.google.com/document/d/1apav-ikZAGKQJXbXFeGb1rfWMPOBv9mPBrdyqFeDaoA/edit?usp=sharing
Shannph Wong Manager • almost 11 years ago
We've taken a harder look at this and we believe that we've identified a bug where there is a null being set to a required field in the Map.
We have a fix that we are testing right now and we plan to have a fix for this posted tomorrow morning (PST). Thanks for the hacking - we will let you know when it's complete.
Evance Mok • almost 11 years ago
Your second code snippet (invite from onSuccess) was the right way to do this as it ensures that the create() call completes before the invitation can be sent. We believe the issue you ran into was for a public channel. In the case of the creation of a public channel, the owner username was not being populated in the object correctly. Though the default behavior is private, one way to verify would be to ensure that setPublic(false), is called on the channel before create().
The Android SDK has been updated with a fix to ensure that the MMXChannel.create() populates this owner username for both public and private channels. To use the new SDK, update your /app/build.gradle file with the new SDK version.
OLD: "com.magnet.mmx:magnet-mmx-client-android:1.5.7@aar"
NEW: "com.magnet.mmx:magnet-mmx-client-android:1.7.4@aar"
Thanks!
Shannph Wong Manager • almost 11 years ago
One more thing, we'll have a formal release early next week with some additional enhancements (of course they are backwards compatible!) to further enhance the product. Let us know if you run into any other issues.
Keep on hacking!
Viet Nhan Nghi Tran • almost 11 years ago
Thanks Evance Mok and Shannph Wong. I will check again. I will let you know if I have issues when hacking.
Viet Nhan Nghi Tran • almost 11 years ago
Can I have your email addresses Shannph Won and Evance Mok?
Viet Nhan Nghi Tran • almost 11 years ago
I have the following questions that need your input. Please have a look at
https://docs.google.com/document/d/1dyHQgf7X_KPDjiRHdQAks1iB3Key5UbluJh2bCKWUtw/edit?usp=sharing
Thanks
Evance Mok • almost 11 years ago
Hi,
Regarding your first two questions, these issues should be fixed in the latest 1.8.4 version of the Android SDK. Try to update to 1.8.4 in your app/build.gradle file. The MMXChannel.inviteUser should work from the successful channel creation and the results of the MMXChannel.findByName should include the matching private channels to which the current user is subscribed (in addition to the the matching public channels).
Finally, regarding your third question about the publishing a message from the console. This console feature allows you to specify String key/value pairs which should be part of the received message content Map MMXMessage.getContent().
Hope that helps. Let us know how this works for you and keep those questions coming...
Best regards!
Vincent Lau • almost 11 years ago
Regarding to not return the private channels by the MMXChannel.findByName(), it was blocked by the server. In order to keep the server backward compatible, we are going to add three new methods in MMXChannel: getAllPrivateChannels(listener), getPrivateChannelByName(name, listener) and getPublicChannelByName(name, listener) in the Android SDK. It will be available in the next release. Let us know if these methods address your issue.
Viet Nhan Nghi Tran • almost 11 years ago
Do you have any update of Android SDK from 1.8.4?
VincentLau • almost 11 years ago
The newest Android SDK 1.8.6 has been released last Friday and it has the new API to get all private channels (getAllPrivateChannels(listener)), or get a private channel by its name (getPrivateChannel(name, listener)).
Viet Nhan Nghi Tran • almost 11 years ago
Great! Thanks for your update.
Viet Nhan Nghi Tran • almost 11 years ago
@VincentLau
I got error when using Android SDK version 1.8.6. Please advise. https://gyazo.com/82765fcf47e10d2ae35bb44349d71654
Evance Mok • almost 11 years ago
Hi,
Our latest released version is actually 1.9.1. Please give that a try.
```
compile("com.magnet.mmx:magnet-mmx-client-android:1.9.1@aar") {
transitive = true
}
```
Thanks!
Viet Nhan Nghi Tran • almost 11 years ago
Glad to hear that higher version. Thanks!