6

I need to provide a Community experience via both mobile and web. Taking mobile out of the question for a minute, I believe I can build the required functionality using Lightning Community Builder, using a mix of standard and a few custom Lightning Components. This app could also be accessed on a mobile browser, but client wants an App experience.

The community could be accessed via Salesforce1, but the client wants a branded experience, so that their customers can download the ClientCo app from an App Store (iOS or GooglePlay). So the question: Is there a way to build a Mobile SDK wrapper for a Community that is built with Lightning Community Builder? I've considered just building a simple Hybrid App that sends you to the Community Login page, but I'm concerned that Locker Service will cause a problem with the Cordova integration layer. Is this a concern?

Besides wanting to provide a branded app, we will like also need to support Push Notifications, and to allow document uploads via the device's camera. Can this be done in a Mobile SDK app that wraps a Lightning Community Builder community? Any special caveats? I'd like to be sure we are considering all possible issues during design, before we begin building.

5

Your approach of a 'simple Hybrid App that sends you to the Community Login page' is the right path here.

As for your other concerns

but I'm concerned that Locker Service will cause a problem with the Cordova integration layer.

You'll essentially be building what's a remote-hybrid app so the community would be loaded in a WebView container. Based on what I've seen, Locker Service does not cause any issues in such a case.

Besides wanting to provide a branded app, we will like also need to support Push Notifications

Push notifications are only supported for native apps and hybrid-local apps. It will NOT work for hybrid-remote app if you use the approach mentioned above. The root cause is the same - you are essentially running your app in a webview container.

and to allow document uploads via the device's camera.

This will work but you'll need to handle it inside your Apex/ VF/ JS code (remember it loads in a WebView)

Can this be done in a Mobile SDK app that wraps a Lightning Community Builder community? Any special caveats? I'd like to be sure we are considering all possible issues during design, before we begin building.

These are valid and important architectural concerns to build at this stage. In addition to the above, you might want to consider

  • Performance - Hybrid-remote apps aren't the best in terms of performance as you're essentially limited to a web view and not leveraging the device performance except for a webview.
  • Code reuse - I understand one of the big factors in chosing this approach would be just to mobilise your existing Lightning Community without the need for building additional mobile apps
  • Hardware Features - Accessing hardware via remote apps is not always optimal as you're not essentially leveraging the capabilities via a bridge.
  • 1
    My locker service concern is in regard to the Cordova.js that is loaded from the Hybrid App to act as a bridge to the Native Cordova code. I understand that LS replaces parts of the standard DOM, and changes how JS code can run within a page. Regarding Push Notifications, I've written a couple of Hybrid Mobile apps (using VF) that accept push notifications; there are Cordova Plugins (one for iOS, one for Android) that enable this. Camera use is handled the same way. My main concern is that Lightning in general or LS in particular may not work correctly with Cordova in a Hybrid Remote App. – Jason Clark Jan 18 '17 at 16:02
  • Also, there's a Spring 17 critical update for locker service that will be GA for all orgs in Summer 17 that tightens the content policies. I have a feeling we are going to have to do some practical testing to know for sure. – Jason Clark Jan 18 '17 at 16:11
  • My company is looking at a use case like this for a client too small to justify full app development. Would it be possible to design the hybrid app to handle an OAuth login and then use that authentication to enter the Lightning Community? Rather than just presenting the login page to the user. So this would be local-hybrid for authentication only (and possibly to register push notifications), and then remote-hybrid for everything else. – Charles T Mar 31 '17 at 21:13
  • 1
    Hi Jason, did you get confirmation in the end? We have one app which seems to be working under locker service, but when doing in another instance it seems to throw error "Uncaught TypeError: Cannot read property '_cordovaNative' of undefined" in cordova.js when we run at 40+ version of api. Any thoughts on what could be causing it? – Doug Jul 16 '18 at 10:05
  • Hi @Doug, This is interesting to read. Where are you loading the cordova.js from (e.g. localhost)? If I try localhost then I get a CSP error. – Todd Halfpenny Sep 19 '18 at 15:19
-1

We are currently using Salesforce community. It works on both Mobile and web. We also have a custom component that can upload multiple files. But, if you need Push Notifications, i guess you have to use some form of Mobile SDK app. Currently Communities do not support Push Notifications as a standard feature. There is a salesforce Mobile SDK that might help you. Altough I have not used it, i remember reading about it and it supports Push Notifications.

Salesforce Mobile SDK.

Here is a video that explains how to implement push notifications in SDK.

Mobile SDK Push Notifications video

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.