Managing a Message

Upload/Download media message#

Whenever you receive a media message from a user, or when retrying to upload a already sent media message you can use built-in sdk functions to upload/download the media content / The below method is applicable only if you are using sdk media server, otherwise you have to handle uploading/downloading the media by your own implementation as well as update the status of the media message.

Mirrorfly.uploadMedia(messageId: MEDIA_MESSAGE_ID);
Mirrorfly.downloadMedia(messageId: MEDIA_MESSAGE_ID);
ArgumentTypeDescription
MEDIA_MESSAGE_IDStringId of the media message

Note : In Mirrorfly.initializeSDK() storageFolderName should be defined to set your own local path to store app media files.

Cancel upload/download#

Whenever you would like to cancel upload/download of a media message , you can use built-in sdk functions to cancel the media content upload/download.The below method is applicable only if you are using sdk media server, otherwise you have to handle cancelling the media by your own implementation as well as update the status of the media message.

Mirrorfly.cancelMediaUploadOrDownload(messageId: MESSAGE_ID);
ArgumentTypeDescription
MESSAGE_IDStringmessage id of the media message

When the user cancelled the media download, then user need to restart the download using Mirrorfly.downloadMedia(messageId: String) method. In case of media upload, the upload initiated once the user sent the message In case of retry call Mirrorfly.uploadMedia(messageId: String).

Upload/Download push notification tap action#

Whenever you would like to add tap action for Upload/Download notification, you can use built-in sdk functions to get the Details. The below method is applicable only if you are using sdk media server, otherwise you have to handle tap action by your own implementation.

This method will give response from Native Android, iOS will return empty by default. When the app is opened by clicking the notification. (Notification Types: Media Status update, MissedCall), This value will be set in Android Plugin side and response will be returned here.

In your main.dart file after Mirrorfly.initializeSDK method add the below method:

MirrorflyNotificationAppLaunchDetails? appLaunchDetails = await Mirrorfly.getAppLaunchedDetails();
ArgumentTypeDescription
appLaunchDetailsMirrorflyNotificationAppLaunchDetails?get app launched details.

Save unsent message of a user/group#

To save a message which is not sent yet but typed can be saved for each user/group can be done by calling the below method.

Mirrorfly.saveUnsentMessage(jid: JID,message: MESSAGE);
ArgumentTypeDescription
JIDStringJid of the user/group
MESSAGEStringText message content

Get unsent message of a user/group#

To get the saved unsent message of a user/group call the below method.

String unsentMessage = Mirrorfly.getUnsentMessageOfAJid(jid: JID);
ArgumentTypeDescription
JIDStringJid of the user/group
TEXT_MESSAGEStringText message content