4

When developing a hybrid app with the Mobile SDK, you need to specify whether it is a 'local' or 'remote'. Local apps use resources on the device, remote apps use resources on a remote server e.g. Visualforce.

My question is: are these mutually exclusive? What if I wanted to start with a local page, then link to a remote page? I assume that can be done but can the context be shared (e.g. authentication/session?) And can the remote page hand off back to a local page?

Just wondering whether it is feasible or a good idea to do an app this way, where I want to minimise the amount of local pages but retain some for specific purposes such as good performance, accessing device features etc.

7

Very interesting question. I was in a similar situation in an app a year back and here's what I researched and hacked together. Officially, you need to pick either the local or remote mode - both are NOT supported simultaneously.

I did manage though to create an app with a local context and invoke my Visualforce pages in a WebView by passing the auth parameters. I did not have a use case where I will need to pass this information back to the local pages but I'm pretty sure it's directly not possible.

One hackish way to do it would be to fire either a trigger or invoke a RESTful Apex web service and have your local pages listen in on it in async mode.

Of course, if you configure your app as Remote, you can't access any local pages or device features at all.

All in all, I realised that it's not worth the effort and switched to a combination of local pages + WebViews.

  • Great insight, thanks very much Guarav. Sounds like I will start with the Local variant and try to avoid the scenario of remote page needing to hand off back to the local. I think this should be possible for my use case. – John Davies Feb 5 '15 at 7:49
  • Digging up this old question as I am trying to implement this same concept: local hybrid app invoking Visualforce page by passing auth parameters. I have been looking around and can't seem to find reference for which auth parameters are needed for this kind of scenario. Do you have any resources or simple examples you could share about which auth parameters/formatting are needed to share the session from the local hybrid app to load the Visualforce page? – Kalin May 18 '17 at 21:13

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.