public final class

FileTransferService

extends RcsService
java.lang.Object
   ↳ com.gsma.services.rcs.RcsService
     ↳ com.gsma.services.rcs.filetransfer.FileTransferService

Class Overview

This class offers the main entry point to transfer files and to receive files. Several applications may connect/disconnect to the API. The parameter contact in the API supports the following formats: MSISDN in national or international format, SIP address, SIP-URI or Tel-URI.

Summary

[Expand]
Inherited Constants
From class com.gsma.services.rcs.RcsService
Public Constructors
FileTransferService(Context ctx, RcsServiceListener listener)
Constructor
Public Methods
void addEventListener(GroupFileTransferListener listener)
Adds a listener on group file transfer events
void addEventListener(OneToOneFileTransferListener listener)
Adds a listener on file transfer events
void clearFileTransferDeliveryExpiration(Set<String> transferIds)
Disables and clears any delivery expiration for a set of file transfers regardless if the delivery of them has expired already or not.
final void connect()
Connects to the API
void deleteFileTransfer(String transferId)
Deletes a file transfer by its unique id from history and abort/reject any associated ongoing session if such exists.
void deleteGroupFileTransfers()
Deletes all group file transfer from history and abort/reject any associated ongoing session if such exists.
void deleteGroupFileTransfers(String chatId)
Deletes file transfer corresponding to a given group chat specified by chat id from history and abort/reject any associated ongoing session if such exists.
void deleteOneToOneFileTransfers(ContactId contact)
Deletes file transfer corresponding to a given one to one chat specified by contact from history and abort/reject any associated ongoing session if such exists.
void deleteOneToOneFileTransfers()
Deletes all one to one file transfer from history and abort/reject any associated ongoing session if such exists.
void disconnect()
Disconnects from the API
FileTransferServiceConfiguration getConfiguration()
Returns the configuration of the file transfer service
FileTransfer getFileTransfer(String transferId)
Returns a current file transfer from its unique ID
boolean isAllowedToTransferFile(ContactId contact)
Returns true if it is possible to initiate file transfer to the contact specified by the contact parameter, else returns false.
boolean isAllowedToTransferFileToGroupChat(String chatId)
Returns true if it is possible to initiate file transfer to the group chat specified by the chatId parameter, else returns false.
void markFileTransferAsRead(String transferId)
Mark a received file transfer as read (i.e.
void removeEventListener(GroupFileTransferListener listener)
Removes a listener on group file transfer events
void removeEventListener(OneToOneFileTransferListener listener)
Removes a listener on file transfer events
FileTransfer transferFile(ContactId contact, Uri file, boolean attachFileIcon)
This method is deprecated. Use transferFile(ContactId, Uri, Disposition, boolean) instead.
FileTransfer transferFile(ContactId contact, Uri file, FileTransfer.Disposition disposition, boolean attachFileIcon)
Transfers a file to a contact.
FileTransfer transferFileToGroupChat(String chatId, Uri file, boolean attachFileIcon)
This method is deprecated. Use transferFileToGroupChat(String, Uri, Disposition, boolean) instead.
FileTransfer transferFileToGroupChat(String chatId, Uri file, FileTransfer.Disposition disposition, boolean attachFileIcon)
Transfers a file to a group chat with an optional file icon.
[Expand]
Inherited Methods
From class com.gsma.services.rcs.RcsService
From class java.lang.Object

Public Constructors

public FileTransferService (Context ctx, RcsServiceListener listener)

Since: API Level 1.5

Constructor

Parameters
ctx Application context
listener Service listener

Public Methods

public void addEventListener (GroupFileTransferListener listener)

Since: API Level 1.5

Adds a listener on group file transfer events

Parameters
listener Group file transfer listener
Throws
RcsServiceNotAvailableException
RcsGenericException
RcsServiceNotAvailableException

public void addEventListener (OneToOneFileTransferListener listener)

Since: API Level 1.5

Adds a listener on file transfer events

Parameters
listener One-to-one file transfer listener
Throws
RcsServiceNotAvailableException
RcsGenericException
RcsServiceNotAvailableException

public void clearFileTransferDeliveryExpiration (Set<String> transferIds)

Since: API Level 1.5

Disables and clears any delivery expiration for a set of file transfers regardless if the delivery of them has expired already or not.

Parameters
transferIds the file transfer IDs
Throws
RcsServiceNotAvailableException
RcsPersistentStorageException
RcsGenericException
RcsPersistentStorageException
RcsServiceNotAvailableException

public final void connect ()

Since: API Level 1.5

Connects to the API

public void deleteFileTransfer (String transferId)

Since: API Level 1.5

Deletes a file transfer by its unique id from history and abort/reject any associated ongoing session if such exists.

Parameters
transferId the file transfer ID
Throws
RcsPersistentStorageException
RcsServiceNotAvailableException
RcsGenericException
RcsPersistentStorageException
RcsServiceNotAvailableException

public void deleteGroupFileTransfers ()

Since: API Level 1.5

Deletes all group file transfer from history and abort/reject any associated ongoing session if such exists.

Throws
RcsServiceNotAvailableException
RcsGenericException
RcsServiceNotAvailableException

public void deleteGroupFileTransfers (String chatId)

Since: API Level 1.5

Deletes file transfer corresponding to a given group chat specified by chat id from history and abort/reject any associated ongoing session if such exists.

Parameters
chatId the chat ID
Throws
RcsServiceNotAvailableException
RcsGenericException
RcsServiceNotAvailableException

public void deleteOneToOneFileTransfers (ContactId contact)

Since: API Level 1.5

Deletes file transfer corresponding to a given one to one chat specified by contact from history and abort/reject any associated ongoing session if such exists.

Parameters
contact the remote contact
Throws
RcsServiceNotAvailableException
RcsGenericException
RcsServiceNotAvailableException

public void deleteOneToOneFileTransfers ()

Since: API Level 1.5

Deletes all one to one file transfer from history and abort/reject any associated ongoing session if such exists.

Throws
RcsServiceNotAvailableException
RcsGenericException
RcsServiceNotAvailableException

public void disconnect ()

Since: API Level 1.5

Disconnects from the API

public FileTransferServiceConfiguration getConfiguration ()

Since: API Level 1.5

Returns the configuration of the file transfer service

Returns
  • FileTransferServiceConfiguration
Throws
RcsServiceNotAvailableException
RcsGenericException
RcsServiceNotAvailableException

public FileTransfer getFileTransfer (String transferId)

Since: API Level 1.5

Returns a current file transfer from its unique ID

Parameters
transferId the file transfer ID
Returns
  • FileTransfer File transfer or null if not found
Throws
RcsPersistentStorageException
RcsServiceNotAvailableException
RcsGenericException
RcsPersistentStorageException
RcsServiceNotAvailableException

public boolean isAllowedToTransferFile (ContactId contact)

Since: API Level 1.5

Returns true if it is possible to initiate file transfer to the contact specified by the contact parameter, else returns false.

Parameters
contact the remote contact
Returns
  • boolean
Throws
RcsPersistentStorageException
RcsServiceNotAvailableException
RcsGenericException
RcsPersistentStorageException
RcsServiceNotAvailableException

public boolean isAllowedToTransferFileToGroupChat (String chatId)

Since: API Level 1.5

Returns true if it is possible to initiate file transfer to the group chat specified by the chatId parameter, else returns false.

Parameters
chatId the chat ID
Returns
  • boolean
Throws
RcsPersistentStorageException
RcsServiceNotAvailableException
RcsGenericException
RcsPersistentStorageException
RcsServiceNotAvailableException

public void markFileTransferAsRead (String transferId)

Since: API Level 1.5

Mark a received file transfer as read (i.e. the invitation or the file has been displayed in the UI).

Parameters
transferId the file transfer ID
Throws
RcsServiceNotAvailableException
RcsPersistentStorageException
RcsGenericException
RcsPersistentStorageException
RcsServiceNotAvailableException

public void removeEventListener (GroupFileTransferListener listener)

Since: API Level 1.5

Removes a listener on group file transfer events

Parameters
listener Group file transfer listener
Throws
RcsServiceNotAvailableException
RcsGenericException
RcsServiceNotAvailableException

public void removeEventListener (OneToOneFileTransferListener listener)

Since: API Level 1.5

Removes a listener on file transfer events

Parameters
listener File transfer listener
Throws
RcsServiceNotAvailableException
RcsGenericException
RcsServiceNotAvailableException

public FileTransfer transferFile (ContactId contact, Uri file, boolean attachFileIcon)

Since: API Level 1.5

This method is deprecated.
Use transferFile(ContactId, Uri, Disposition, boolean) instead.

Transfers a file to a contact. The parameter file contains the URI of the file to be transferred (for a local or a remote file). The parameter contact supports the following formats: MSISDN in national or international format, SIP address, SIP-URI or Tel-URI. If the format of the contact is not supported an exception is thrown.

Parameters
contact the remote contact Identifier
file Uri of file to transfer
attachFileIcon File icon option. If true, the stack tries to attach fileicon. Fileicon may not be attached if file is not an image or if local or remote contact does not support fileicon.
Returns
  • FileTransfer
Throws
RcsPersistentStorageException
RcsServiceNotAvailableException
RcsGenericException
RcsPersistentStorageException
RcsServiceNotAvailableException

public FileTransfer transferFile (ContactId contact, Uri file, FileTransfer.Disposition disposition, boolean attachFileIcon)

Since: API Level 1.6

Transfers a file to a contact. The parameter file contains the URI of the file to be transferred (for a local or a remote file). The parameter contact supports the following formats: MSISDN in national or international format, SIP address, SIP-URI or Tel-URI. If the format of the contact is not supported an exception is thrown.

Parameters
contact the remote contact Identifier
file Uri of file to transfer
disposition File disposition
attachFileIcon File icon option. If true, the stack tries to attach fileicon. Fileicon may not be attached if file is not an image or if local or remote contact does not support fileicon.
Returns
  • FileTransfer
Throws
RcsPersistentStorageException
RcsServiceNotAvailableException
RcsGenericException
RcsPersistentStorageException
RcsServiceNotAvailableException

public FileTransfer transferFileToGroupChat (String chatId, Uri file, boolean attachFileIcon)

Since: API Level 1.5

This method is deprecated.
Use transferFileToGroupChat(String, Uri, Disposition, boolean) instead.

Transfers a file to a group chat with an optional file icon.

Parameters
chatId the chat ID
file Uri of file to transfer
attachFileIcon Attach file icon option. If true, the stack tries to attach fileIcon. FileIcon may not be attached if file is not an image or if local or remote contact does not support fileIcon.
Returns
  • FileTransfer
Throws
RcsPermissionDeniedException
RcsPersistentStorageException
RcsServiceNotAvailableException
RcsGenericException
RcsPermissionDeniedException
RcsPersistentStorageException
RcsServiceNotAvailableException

public FileTransfer transferFileToGroupChat (String chatId, Uri file, FileTransfer.Disposition disposition, boolean attachFileIcon)

Since: API Level 1.6

Transfers a file to a group chat with an optional file icon.

Parameters
chatId the chat ID
file Uri of file to transfer
disposition File disposition
attachFileIcon Attach file icon option. If true, the stack tries to attach fileIcon. FileIcon may not be attached if file is not an image or if local or remote contact does not support fileIcon.
Returns
  • FileTransfer
Throws
RcsPermissionDeniedException
RcsPersistentStorageException
RcsServiceNotAvailableException
RcsGenericException
RcsPermissionDeniedException
RcsPersistentStorageException
RcsServiceNotAvailableException