If you use the ScreenManager
, image uploading for template graphics, soft buttons, and menu items is handled for you behind the scenes. However, you will still need to manually upload your images if you need images in an alert, VR help lists, turn-by-turn directions, or other features not currently covered by the ScreenManager
.
The JavaScript manager does not currently handle uploading graphics for menu items. This will be included in a future version.
You should be aware of these four things when using images in your SDL app:
hmiLevel
is NONE
. For more information about permissions, please review Understanding Permissions.Before uploading images to a head unit you should first check if the head unit supports graphics. If not, you should avoid uploading unnecessary image data. To check if graphics are supported, check the getCapability()
method of a valid SystemCapabilityManager
obtained from sdlManager.getSystemCapabilityManager()
to find out the display capabilities of the head unit.
const imageFields = sdlManager.getSystemCapabilityManager().getDefaultMainWindowCapability().getImageFields(); const areImagesSupported = (imageFields.length > 0);
The FileManager
uploads files and keeps track of all the uploaded files names during a session. To send data with the FileManager
, you need to create either a SdlFile
or SdlArtwork
object. Both SdlFile
s and SdlArtwork
s can be created with using filePath
, or String
.
const artwork = new SDL.manager.file.filetypes.SdlArtwork('image_name', SDL.rpc.enums.FileType.GRAPHIC_PNG, image, false); const success = await sdlManager.getFileManager().uploadFile(audioFile) .catch(error => { // handle errors here return false; }); if (success) { // Image upload successful }
Similar to other files, artworks can be persistent, batched, overwrite, etc. See Uploading Files for more information.
View on GitHub.com