build.gradlefile in the app module and paste this line within the
Mitterobject. To start working, you need to configure this object with your application details that you can access from Mitter Dashboard.
onCreate()of your app’s
Mitterobject as a global variable in your
onCreate()you need to configure this object to connect with your application on the Mitter.io platform. Additionally, you can put down some extra configuration as to how the SDK should behave locally.
UserAuthobject which will specify the user you want the SDK to log in as. The
UserAuthobject takes a User ID and a User Auth Token as its parameters.
Mitterobject with the User ID of
089771b6-6002-43db-bdc5-81e6ef7b6ef9and its respective auth token which is nothing but a JWT.
LoggingLevel.NONE- Prints nothing
LoggingLevel.BASIC- Prints only basic operation success/error messages
LoggingLevel.FULL- Prints out everything including object data. Not a good idea to use this level for production usage
MitterConfigin place, constructing the
Mitterobject is simple. You can do as follows:
Applicationshould look something like this:
Mitterobject that you created in the previous step.
Channelobject and the
Channelmodel looks like this:
Channelobject, you can now swiftly create a new channel by calling the
createDirectMessageChannel()method, except you have full control over the channel parameters, including the channel ID.
FetchMessageConfigobject to the method.
sendMessage()method which accepts a
Messageobject totally constructed by you.
TimelineEventis like a categorised timestamp on your messages. Here, we’re specifying a
SentTimeevent which is mandatory when creating a
Messageobject. You can learn more about Timeline Events over here.
TimelineEventset, the only thing’s left is to create your customised
Messageobject. Here’s how you can do that:
messageDatafield. Use this field to define any custom buttons or additional styling information that you want to show up in the message.
Messageobject is set, it’s time that you send it. The sending part is really easy:
ImageMessage. The main advantage of choosing this type is that Mitter.io automatically generates thumbnails for the attached image without any effort from your part. For more details, see the reference.
ImageMessagewith the SDK. It’s pretty similar to sending a text message, just with an added image file parameter:
ImageMessageas a regular image message that you see in every other messaging apps. You have an image with some text at the bottom, which is usually the caption.
Fileobject pointing to your image.