Salesforce

Alternative Images - Android and iOS (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

Alternative Images - Android and iOS (Magic xpa 4.x)

The Android and iOS RIA mobile clients support alternative images for different screen densities.

You can define different images in different resolutions and place them in specific subfolders on the server as defined below. The RIA client will automatically retrieve the matching image according to the device’s characteristics.

Note:

  • The ServerFileToClient function uses the same algorithm, so if you need to fetch images (or any file in general), it will be done according to the same rules.

  • You can see the device characteristics used in this mechanism using the ClientOSEnvGet() function with the value of 'device_resource-folder'.

On Android devices:

The search will be done according to the platform (Android), screen size (for example: normal, large), screen aspect (for example: long, notlong) and the screen pixel density (dpi) (for example: hdpi).

The search is done in different combinations of these parameters according to the Android algorithm, so you do not have to define images according to all of these parameters.

Refer to: http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources.

For example, if the image file is defined to be at c:\images\a.jpg, then for an Android device defined as large screen size, notlong aspect ratio and hdpi pixel density, you can place the image in any subfolder that does not contradict with any of the device’s characteristics, for example: c:\images\Android\, c:\images\Android\large\, c:\images\Android\large\hdpi\, c:\images\Android\hdpi\.

On iOS devices:

The search will be done according to the platform (iOS), device modifier (for example: ~iPad, ~iPhone) and the high resolution indicator (for example: @2).

If the image is not found in the specific subfolders, it will be searched for in the parent folder and so on until reaching the original folder.

For example, if the image file is defined to be at c:\images\a.jpg, then for an iPad 3 device (identified as an iOS platform, ~iPad device modifier and @2 high resolution indicator), the server will fetch the a.jpg file from c:\images\iOS\~ipad\@2\.

If the file is not found there, the server will fetch the file from c:\images\iOS\~ipad\, if the file is still not found, the server will fetch the file from c:\images\iOS\ and if the file is still not found, the server will fetch the file from the original location: c:\images\.

Since version: 2.3

Reference
Attachment 
Attachment