Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search

Uploading Files

In almost all cases, you will not need to handle uploading images because the screen manager API will do that for you. There are some situations, such as VR help-lists and turn-by-turn directions, that are not currently covered by the screen manager so you will have manually upload the image yourself in those cases. For more information about uploading images, see the Uploading Images guide.

Uploading an MP3 Using the File Manager

The FileManager uploads files and keeps track of all the uploaded files names during a session. To send data with the file manager you need to create either a SdlFile or SdlArtwork object. Both SdlFiles and SdlArtworks can be created with a Uri, byte[], or resourceId.

byte[] mp3Data = Get the file data;
SdlFile audioFile = new SdlFile("File Name", FileType.AUDIO_MP3, mp3Data, true);

Batching File Uploads

If you want to upload a group of files, you can use the FileManager batch upload methods. Once all of the uploads have completed you will be notified if any of the uploads failed.

sdlManager.getFileManager().uploadFiles(sdlFileList, new MultipleFileCompletionListener() {
    public void onComplete(Map<String, String> errors) {


File Persistance

SdlFile and its subclass SdlArtwork support uploading persistant files, i.e. files that are not deleted when the car turns off. Persistance should be used for files that will be used every time the user opens the app. If the file is only displayed for short time the file should not be persistent because it will take up unnecessary space on the head unit. You can check the persistence via:

Boolean isPersistent = file.isPersistent();

Be aware that persistance will not work if space on the head unit is limited. The FileManager will always handle uploading images if they are non-existent.

Checking the Amount of File Storage Left

To find the amount of file storage left for your app on the head unit, use the ListFiles RPC.

ListFiles listFiles = new ListFiles();
listFiles.setOnRPCResponseListener(new OnRPCResponseListener() {
    public void onResponse(int correlationId, RPCResponse response) {
            Integer spaceAvailable = ((ListFilesResponse) response).getSpaceAvailable();
            Log.i("SdlService", "Space available on Core = " + spaceAvailable);
            Log.i("SdlService", "Failed to request list of uploaded files.");

    public void onError(int correlationId, Result resultCode, String info){
        Log.e(TAG, "onError: "+ resultCode+ " | Info: "+ info );


Checking if a File Has Already Been Uploaded

You can check out if an image has already been uploaded to the head unit via the FileManager's remoteFileNames property.

Boolean fileIsOnHeadUnit = sdlManager.getFileManager().getRemoteFileNames().contains("Name Uploaded As")

Deleting Stored Files

Use the file manager’s delete request to delete a file associated with a file name.

sdlManager.getFileManager().deleteRemoteFileWithName("Name Uploaded As", new CompletionListener() {
    public void onComplete(boolean success) {


Batch Deleting Files

sdlManager.getFileManager().deleteRemoteFilesWithNames(remoteFiles, new MultipleFileCompletionListener() {
    public void onComplete(Map<String, String> errors) {

View on GitHub.com
Previous Section Next Section