Tuesday, March 18, 2014

How to launch native iPad apps on Salesforce1

I have stumbled once or twice to question about launching native apps on Salesforce1 platform. I resolved this problem by using Apple’s URL schemes. Here’s how:
Meeting Assistant technical banner


Create a new Visual Force page

Go to Salesforce Settings → App Setup → Develop → Pages → and choose New .
Creating a new Visual Force page on Salesforce.com

Make sure your page is available on Salesforce Mobile apps. On the following script, I simply want to redirect user to our app using URL scheme, in our case it’s "masf://" . 
                         

Launching Meeting Assistant for Salesforce

     


Create New Global Action

Next you need a cool button to your Salesforce1 to launch that code.
Go to Salesforce Settings → App Setup → Create → Global Actions → New Action
We want to use our state of the art VF page, so action type should be “Custom Visualforce” .
Fill the rest of the information fields to your desire.
Creating a new global action on Salesforce.com

Check Xcode URL Scheme

Next let’s check our mobile app settings. Launch your xCode, open Project Targets and URL Types. Add the desired launch url. If you want to be sure it works, be creative with the URL Scheme - if your iDevice have more than 1 app with same URL Schemes, Apple chooses what app it will launch.


Adding URL Scheme in xCode

Build your app to your iDevice and try it out! Here’s how it works in our case.




Since you can add whatever parameters you want to the url and then parse them in your native app, nearly anything should be possible.




Mr Ville Mettälä
Co-Founder and VP Sales at Punos Mobile Ltd
Twitter: 

4 comments:

  1. March 21, 2014 at 6:17 PM

    Have you looked into doing the same thing with Android? iOS seems to open up apps just based on the protocol definition of the link where as Android requires the use of intents.

    Reply
  2. March 22, 2014 at 10:26 AM

    Not yet, unfortunately. But we are developing for Android at the moment, most probably we will check this sooner or later.

    Reply
  3. April 17, 2014 at 1:13 AM

    I have been dealing with the same issue for quite some time. I did not think to use the meta tag for the redirect, which is interesting. I have instead been using the special S1 JavaScript method sforce.one.navigateToURL() which seems to work nicely on both iOS and Android.

    One problem I've never been able to solve well, however, is the problem of detecting whether the native app you are referencing is installed on the user's device or not. If it is not, these redirects will fail. It would be ideal to have some ability to detect this in advance, and if the app exists, perform the redirect, but if not, show a message with a link to download the appropriate app.

    As it is the best I can do is an elaborate system of timers that tries to infer whether the redirect was successful, and if not, shows the app store link. But curious how others have solved this

    Reply
  4. April 17, 2014 at 1:24 AM

    Thanks dannypanzer, gotta check that JavaScript method asap. We have heard about that, but never tried.

    About checking if the app is installed, we share same knowledge as you - timeouts would do the trick, but some other way would be much nicer.

    Reply

Newer Post Older Post Home