1

I am working on a Managed Package for the AppExchange, and one requirement is to enable it to be user-friendly on Mobile Devices.

The app will mainly consist of Native Features and use Standard and Lightning Custom UI (maybe a bit of Visualforce).

I am confused by the material I found related to Mobile Readiness. It seems to contradict each other.

  1. How should Salesforce be used on Mobile Devices? A browser or Salesforce app?
  2. Is there a difference between devices? E.g. Should Tablets use a mobile Browser and Phones the Salesforce native app?
  3. If I use Base Components (Aura and LWC), are they responsive and mobile-ready by default?
  4. What do I need to take care of when building my own LWC components?
  5. Is it still recommended to build Native Android or Iphone apps using APIs as Salesforce recommended a few years ago?
  6. Is there a detailed and authoritative guide that describes that? Something official from Salesforce?
3
  • 2
    I can say that the Salesforce mobile SDK allows use of an embedded web view, but they explicitly change the User Agent to make things work. Using a standard web view with standard User Agent string for iOS results in Salesforce not rendering correctly in all cases. We don't use the SDK and have recently had to provide a fix for iOS to modify the User Agent string like mobile SDK does. It's crazy the way Salesforce don't support standard mobile browser access - they essentially say these are not supported here.
    – Phil W
    Jan 9, 2023 at 10:56
  • 2
    (We have a React Native app that allows extension using embedded Digital Experience pages in a Web View.) Salesforce seems to want all mobile use to be through the mobile SDK, and I don't really understand why. Yes, they support the iPad Safari, but not the iPhone Safari, and supposedly have no support for Android outside the mobile SDK. We've only had rendering issues on iOS (without the mobile SDK). See above comment. Android has worked fine for us so far.
    – Phil W
    Jan 9, 2023 at 11:00
  • 1
    In terms of writing your own LWCs, make sure these are responsive to device characteristics (generally width is critical to cater for). Try to avoid things like datatable too.
    – Phil W
    Jan 9, 2023 at 16:52

1 Answer 1

2

I cannot answer every part of your question, but here's what I can contribute:

1. How should Salesforce be used on Mobile Devices? A browser or Salesforce app?

According to the documentation, Salesforce expects Salesforce to only be consumed on mobile devices using Salesforce Mobile SDK-based apps.

The documentation implicitly excludes support for all mobile browsers with the one exception of Safari on iPad. No Android or (other) iOS browsers are supported.

That said, if you look at the Salesforce Mobile SDK, you will see that this supports the use of an embedded WebView, which is effectively a mobile browser within the app. The difference here is that they explicitly mess with the User Agent string and Salesforce recognises this during page rendering.

Without this User Agent string modification it is certainly the case that iOS device apps that use a WebView (i.e. apps that do not use the mobile SDK) exhibit rendering issues for some scenarios; we've seen a failure to render correctly with screen flows. That said, we have not had any issues with a non-mobile-SDK WebView on any Android devices, so far.

Honestly, I do not understand why Salesforce have decided not to support mobile browsers, or at least Chrome on iOS and Android.

2. Is there a difference between devices? E.g. Should Tablets use a mobile Browser and Phones the Salesforce native app?

This is your choice, at least on iPads. If you want to officially and fully support Android (on tablets or phones) you need a mobile app based on the Salesforce Mobile SDK. Or one that modifies the User Agent string in a manner compatible with the mobile SDK tweaks.

3. If I use Base Components (Aura and LWC), are they responsive and mobile-ready by default?

I cannot fully answer this, but can say that lightning-datatable does not (or did not when we tried it) and that you should avoid tabular presentations in your mobile-compatible UX.

4. What do I need to take care of when building my own LWC components?

You should definitely use approaches that are mobile friendly when creating your components. Using CSS flex is a good way to address this. This is best applied via the use of SLDS Grids. This allows OOTB responsive re-flowing of grid-like layouts based on the device width.

5. Is it still recommended to build Native Android or Iphone apps using APIs as Salesforce recommended a few years ago?

I cannot fully answer this, however the following points should be considered:

  1. Always use a Connected App with an OAuth 2 flow to allow the user to login to the org through the app. You need this whether that's for API or web UI usage. Doing this means you can have a refresh token and can avoid the need for the user to re-login every 2 hours of idle time.
  2. Use of APIs faces the challenge of API limits, especially if your app users have Community/Community Plus regular or Login licenses - Community licenses add no API allowance and Community Plus only adds 10 API calls per user per day to your limits. It is, however, possible to purchase additional API request allocations (as per the documentation link at the start of this point).
  3. Web UI usage is best addressed through the Mobile SDK's WebView, or using an appropriate User Agent string tweak.

What I can say is that our app is a mix of API-based calls and embedded WebView usages; the API-based side of things is used for built-in functionality while the WebView is used for "extensions" to the app. Our built-in functionality is designed to support offline use, while the "extensions" are online only. If you need offline you either need to create a progressive web app (I don't know if Salesforce can even support this) or you need an appropriately implemented app.

6. Is there a detailed and authoritative guide that describes that? Something official from Salesforce?

To be answered by Salesforce... we arrived at our approach after reading the general documentation and doing some PoC work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .