Native Mobile Dynamic Images in Gallery

0
I have an app with an image entity and both Responsive Web side as well as Native Mobile part of the app, which are pretty much the same by functionality. For some reason, the images (LocationImage) that I have set for a Location entity are visible in the web app, but not visible in the Native Mobile. I have gone through all the settings and rights I can think of, but so far nothing has helped. Any ideas what I am missing?
asked
5 answers
0

This is usually not a visibility or security issue, but a native-specific limitation or configuration.


In Native Mobile, images behave differently than in web. The most common reason is that the image is not being loaded through the correct widget or data source.


First, make sure you are using the Native Image widget, not a web-based one. Web Image widgets do not work properly in native apps.


Second, check the data source of your Gallery. In native, data should come from a nanoflow or a supported source. If the image is not fully available on the client, it will not render.


Another important point is the image entity. It must be a specialization of System.Image, and the association between your Location and LocationImage must be correctly retrieved.


Also verify that the image is committed, the user has read access, and the file is actually stored (not empty).


If everything looks correct, try explicitly retrieving the image in a nanoflow before rendering the page. In native, the data needs to be available on the client side.


If this resolves your issue, please mark it as accepted.

answered
0

It seems that the entire app is used Online from the tablet that I am testing and nothing is synced to the device. If I change any entity Synchronization mode to other than "Online", the app will crash in startup with this:

"
com.mendix.webui.WebUIException: Unknown client action 'retrieve_by_xpath'

"


I have no idea what this points into, any ideas? The Make It Native app version should be correct, this happens also if I create an APK for Android and install and run it.

answered
0

The error Unknown client action 'retrieve_by_xpath' is the key indicator here. It usually means something in your Native app is still performing a client-side XPath retrieve, which is not supported in offline/native the same way as in web.


So the issue is likely in the page or nanoflow datasource, not the Image widget itself.


I would suggest checking:

  • page datasources (Data View / List / Gallery)
  • nanoflow datasources
  • any widgets using XPath-based retrieves
  • logic that still assumes online behavior


Also, since the app crashes when switching from Online, that strongly indicates part of the page is not offline-compatible yet.


One more thing to consider: Native apps cache pages and nanoflows in the app bundle. After changes, make sure to rebuild/reinstall the app or clear cache, otherwise you may still hit outdated client logic.


So the fix is:

  • remove XPath-based client retrieves
  • use page parameters / associations / offline-supported retrieves
  • rebuild the app before testing again


Once that is resolved, the image issue should be easier to verify separately.


answered
0

Hi,

Regarding the Location entity synchronization — could you confirm whether you are syncing the Location objects through navigation or using a microflow (Sync to device)?

  • If you are using navigation then add image entity in the navigation after that clear the cache in your developer app and try again, it is recommended only when the data is static and limited. Otherwise, it may impact app performance and make the mobile app slow.
  • If you are using a microflow, that is the better approach for larger datasets. In that case, ensure you also include a sync for the associated Image entity.

Additionally, if your Location entity has an image association defined as one-to-one, consider changing it to a one-to-many association, as one-to-one associations are not supported in native mobile scenarios.

Let me know your current setup so I can suggest a more precise solution.

answered
0

Hi,


If images are visible in Web but NOT in Native Mobile, the issue is almost always due to how Native apps fetch and display images (files) — which is different from Web.

Actual Root Cause

In Mendix Native Mobile:

Images are files (binary data) and are NOT automatically fetched like normal attributes.

So even if:

  • Entity is correct
  • Association is correct
  • Data is present

Still, image will NOT display unless it is properly retrieved on the device.

1. Entity Setup (Mandatory)

Your image entity must:

  • Extend → System.Image
  • Be associated properly (e.g., Location → LocationImage)

2. Data Must Be Retrieved on Device

In Native:

  • You MUST retrieve images using a nanoflow
  • Use:
    • Retrieve (by association) from Location → LocationImage

Example:

  • Page DataView → Location
  • Inside nanoflow:
    • Retrieve LocationImage via association

If you directly bind without retrieval → image will NOT appear

3. Use Native Image Widget Properly

In the Image widget:

  • Source → Dynamic
  • Select → LocationImage

Do NOT:

  • Use URL
  • Use Web widgets

4. If Using Offline App

If your app is Offline-first:

  • Your image entity must be:
    • Included in Offline synchronization
  • Otherwise:
    • Images will NOT be downloaded to device

Also:

  • File entities require proper sync handling
  • Without sync → only metadata comes, not actual image

5. Access Rules Strict in Native

Ensure:

  • User role has Read access to:
    • Location
    • LocationImage

Otherwise:

  • Data loads in Web (admin/session-based)
  • But fails silently in Native

Most Common Mistake

Developers assume:

"If it works in Web, it should work in Native"

But Native:

  • Does NOT auto-fetch associated file content
  • Requires explicit nanoflow retrieval + sync

  • Web → server-driven → auto loads images
  • Native → device-driven → manual data handling required

So:

If images are not visible in Native, it is because image data is not retrieved/synced properly on device

Retrieve images via nanoflow + ensure offline sync (if offline) + use System.Image entity.


answered