public final class

FileUploadService

extends RcsService
java.lang.Object
   ↳ com.gsma.services.rcs.RcsService
     ↳ com.gsma.services.rcs.upload.FileUploadService

Class Overview

This class offers the main entry point to upload a file to the RCS content server. Several applications may connect/disconnect to the API. There is no pause and resume supported here.

Summary

[Expand]
Inherited Constants
From class com.gsma.services.rcs.RcsService
Public Constructors
FileUploadService(Context ctx, RcsServiceListener listener)
Constructor
Public Methods
void addEventListener(FileUploadListener listener)
Adds a listener on file upload events
boolean canUploadFile()
Can a file be uploaded now
final void connect()
Connects to the API
void disconnect()
Disconnects from the API
FileUploadServiceConfiguration getConfiguration()
Returns the configuration of the file upload service
FileUpload getFileUpload(String uploadId)
Returns a current file upload from its unique ID
Set<FileUpload> getFileUploads()
Returns the list of file uploads in progress
void removeEventListener(FileUploadListener listener)
Removes a listener on file upload events
FileUpload uploadFile(Uri file, boolean attachFileIcon)
Uploads a file to the RCS content server.
[Expand]
Inherited Methods
From class com.gsma.services.rcs.RcsService
From class java.lang.Object

Public Constructors

public FileUploadService (Context ctx, RcsServiceListener listener)

Since: API Level 1.5

Constructor

Parameters
ctx Application context
listener Service listener

Public Methods

public void addEventListener (FileUploadListener listener)

Since: API Level 1.5

Adds a listener on file upload events

Parameters
listener Listener
Throws
RcsServiceNotAvailableException
RcsGenericException
RcsServiceNotAvailableException

public boolean canUploadFile ()

Since: API Level 1.5

Can a file be uploaded now

Returns
  • boolean true if a file can be uploaded, else returns false
Throws
RcsServiceNotAvailableException
RcsGenericException
RcsServiceNotAvailableException

public final void connect ()

Since: API Level 1.5

Connects to the API

public void disconnect ()

Since: API Level 1.5

Disconnects from the API

public FileUploadServiceConfiguration getConfiguration ()

Since: API Level 1.5

Returns the configuration of the file upload service

Returns
  • FileUploadServiceConfiguration
Throws
RcsServiceNotAvailableException
RcsGenericException
RcsServiceNotAvailableException

public FileUpload getFileUpload (String uploadId)

Since: API Level 1.5

Returns a current file upload from its unique ID

Parameters
uploadId Upload ID
Returns
  • FileUpload File upload or null if not found
Throws
RcsServiceNotAvailableException
RcsGenericException
RcsServiceNotAvailableException

public Set<FileUpload> getFileUploads ()

Since: API Level 1.5

Returns the list of file uploads in progress

Returns
  • Set<FileUpload> List of file uploads
Throws
RcsServiceNotAvailableException
RcsGenericException
RcsServiceNotAvailableException

public void removeEventListener (FileUploadListener listener)

Since: API Level 1.5

Removes a listener on file upload events

Parameters
listener Listener
Throws
RcsServiceNotAvailableException
RcsGenericException
RcsServiceNotAvailableException

public FileUpload uploadFile (Uri file, boolean attachFileIcon)

Since: API Level 1.5

Uploads a file to the RCS content server. The parameter file contains the URI of the file to be uploaded (for a local or a remote file).

Parameters
file Uri of file to upload
attachFileIcon Attach file icon option. If true and if it's an image, a file icon is attached.
Returns
  • FileUpload
Throws
RcsMaxAllowedSessionLimitReachedException
RcsServiceNotAvailableException
RcsGenericException
RcsMaxAllowedSessionLimitReachedException
RcsServiceNotAvailableException