What does Messenger mean in Android Development?

Channel:
Subscribers:
15,200
Published on ● Video Link: https://www.youtube.com/watch?v=I8CKCs4DTbs



Game:
Duration: 2:08
11 views
0


Find out what Messenger means in Android Development.

i. Some key inherited constants used in Android Messenger development include:

- Messenger.class - This is the superclass for all Messenger classes. It defines basic constants like MESSAGE_ID, MESSAGE_TIMESTAMP, etc. that child Messenger classes inherit.

- MessengerPlatform.class - Provides constants for Messenger platform-specific parameters like ORIGIN, DESTINATION, THREAD_TYPE, etc. Used for Messenger integrations.

- SendMessage.class - Defines constants like CONTENT_TYPE, GEO, COMPOSER_INPUT, etc. for composing Messenger messages to send.

- MessagePayload.class - Contains constants for message payload parameters like RECIPIENT, SENDER, MESSAGE_ID, SEQNO that get attached to outgoing messages.

- MessengerThreadClient.class - Includes thread-related constants like PARTICIPANT_ROLE, THREAD_ID, THREAD_NAME that are useful for multi-user Messenger threads.

- MessengerCallClient.class - Provides CALL_ID, IS_GROUP_CALL, DURATION constants for voice/video call features.

- MessengerSharingClient.class - Defines constants like SHARE_TARGET, MEDIA_TYPE, MEDIA_URI used for sharing content to Messenger connections.

- MessengerGroupThreadClient - Contains GROUP_THREAD_ID, GROUP_THREAD_NAME, GROUP_ROLE constants for group messaging.

So in summary, these inherited constant interfaces allow easier development by providing predefined keys for most common Messenger parameters when constructing messages, threads, calls, etc. Reduces need for custom string constants.

ii. Some key fields commonly used in Android Messenger development include:

- **MessengerClient** - Core client object for sending/receiving messages and managing connections. Key fields include messengerClientId, appId, pageId etc.

- **User** - Represents a Messenger user. Contains fields like id, firstName, lastName, profilePic.

- **Message** - Encapsulates a Messenger message. Includes fields like messageId, text, attachments etc.

- **Thread** - Represents a Messenger thread. Contains fields like threadId, participants, name.

- **SendMessage** - Object for composing a message to send. Has fields like recipientId, messageBody, customPayload.

- **ReceiveMessage** - Object received when a new message comes in. Has fields like senderId, messageId, messageText.

- **MessagePayload** - Lower level object that attaches metadata like sender info to outgoing messages.

- **MessengerCall** - Represents a voice/video call. Contains fields like callId, participants, duration.

- **MessengerSharingContent** - Encapsulates content being shared via Messenger. Has fields like contentUri, contentType.

- **MessengerGroupThread** - Object representing a Messenger group thread. Contains fields like threadId, groupName, roles.

So in summary, these are some of the key objects and fields for messaging, calling, groups etc. that come into play when developing on Messenger platform. Having a good grasp of these fields helps in building Messenger integrations efficiently.

iii. Here is an example of a simple Messenger app in Android:

1. Create a new Android project in Android Studio.
2. Select the "Empty Activity" template and click "Next."
3. Enter a name and package name for your project, and click "Finish."
4. Open the activity_main.xml file in the layout editor.
5. Drag and drop a Button and a TextView to the layout.
6. Set the TextView's text to "Send Message."
7. Set the Button's onClick attribute to "sendMessage()."
8. Open the MainActivity.java file in the code editor.
9. Add the following code to the sendMessage() method:

```
public void sendMessage() {
// Get the text message from the TextView.
String message = findViewById(R.id.textView).getText().toString();

// Send the message to the other user.
// TODO: Implement this method.
}
```

10. Build and run your app.
11. Click the button to send a message.

This is just a very simple example of a Messenger app in Android. You can add more features to your app, such as the ability to send and receive multiple messages, create chat groups, and share files.

Learn more@ https://www.youtube.com/c/ITGuides/search?query=Android.