If you are looking to upload images for use in template graphics, soft buttons, or the menu, you can use the ScreenManager. Other situations, such as VR help lists and turn by turn directions, are not currently covered by the ScreenManager
.
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.To learn how to use images once they are uploaded, please see Text, Images, and Buttons.
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, use the getCapability()
method of a valid SystemCapabilityManager
obtained from sdlManager.getSystemCapabilityManager()
to find out the display capabilities of the head unit.
sdlManager.getSystemCapabilityManager().getCapability(SystemCapabilityType.DISPLAY, new OnSystemCapabilityListener(){ @Override public void onCapabilityRetrieved(Object capability){ DisplayCapabilities dispCapability = (DisplayCapabilities) capability; boolean graphicsSupported = dispCapability.getGraphicSupported(); } @Override public void onError(String info){ Log.i(TAG, "Capability could not be retrieved: "+ info); } });
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 a Uri
, byte[]
, or resourceId
.
SdlArtwork artwork = new SdlArtwork("image_name", FileType.GRAPHIC_PNG, <image byte[]>, false); sdlManager.getFileManager().uploadFile(artwork, new CompletionListener() { @Override public void onComplete(boolean success) { 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