The Salesforce Platform enables ISVs to rapidly build enterprise mobile apps with our Platform Mobile Services. You can innovate even faster by leveraging our Mobile Packs and Mobile SDKs. In this blog post we will show you how to further enhance your mobile app and make it enterprise-grade by using a managed package.

Most prosumer apps are not enterprise-grade

Listing your app on the AppExchange and various app stores lets you reach a wide audience. Most often these will be “prosumers,” or power users who are actively browsing for apps to improve their productivity. This is an excellent opportunity to seed and grow – getting a critical mass of users in a company before selling an enterprise-wide license directly to the company.

There is a different set of requirements when deploying mobile apps to an entire organization. Enterprise-grade mobile apps are secure, customizable, and robust. IT departments need the ability to define and enforce policies for accessing company data from the mobile app. They also need visibility into who is using the app and a way to control who has access. Administrators ultimately will want to configure and customize your app to suit their business processes.

Using a managed package

The good news is that you can easily accomplish all of these things and make your app enterprise-grade with a managed package. A managed package lets your mobile app take full advantage of the security, scalability, and customizability of the Salesforce Platform.

Using Identity and Connected Apps to enforce policy

Salesforce Identity and Connected Apps provide the fastest way to give administrators the ability to define access policies for your app deployment. Identity makes authentication and authorization easy by enabling Single Sign-On (SSO). Connected Apps add additional levels of control, allowing admins to control who can use the application and to define various security policies to be enforced by the application. They allow an organization to extend their corporate security outside their environment and down to their users’ devices.

To use Connected Apps, all you have to do is define one so that the Salesforce platform knows about your app.

You include the Connected App in your package and the customer installs it. Once a Connected App is installed, administrators can set OAuth, SAML, and security controls like IP restrictions, PIN enforcement, and session timeouts:

Using the License Management Application to control access

The License Management App (LMA) lets you apply licensing to your AppExchange applications. Using it in conjunction with Connected Apps gives your customers more control and flexibility over access policies. Each time a customer or a prospect installs your managed package, a lead and license record are created in the LMA. You can then apply licensing to control how many users in the customer organization can access your app and for how long. Customer admins can assign these licenses to their users, so they know exactly who is using your mobile app.

You can even use the LMA to provide a free trial period of your app and keep track of how many customers have installed your package.

LMA Example

We’ll show you how easy it is to leverage the LMA to detect whether the current user is licensed to use your mobile app.

There are two parts to this implementation:

1. A simple Apex web service method you include in your managed package. This will tell you whether the current user has a license to use your package.

2. A simple method in your mobile application that calls this web service method to check for licensing.

In this example, the mobile app checks for licensing confirmation after the user logs in and adjusts the UI accordingly:

The screenshot on the left shows that a licensed user has full use of your app. The screenshot on the right shows a simple message to a user who does not have a license. The code used in this example is included below:

LMA Code Example

 

Include this code in your managed package.

//Expose the ‘islicensed’ REST endpoint 
@RestResource(urlMapping='/islicensed/*')
global with sharing class licenseRest {

   // Set up as HTTP GET
   @HttpGet
   global static String doPost() {
  	 //Check if current user is licensed to your package
  	 Boolean isLicensed = System.Userinfo.isCurrentUserLicensed('your_app_namespace');

  	 //Return t or f according to license status
  	 if(isLicensed)
  		 return 't';
  	 else
  		 return 'f';       	 
   }
}

 

Include this code in your mobile app.

// Sample Javascript to check if the user has an app license 
function checkLicense(sessId) {
   // The user is already authenticated. Get the session ID
   var sessionId = sessId;
   var request = new XMLHttpRequest();

// Make http GET request to webservice with the session ID
   request.open("GET", "https://na15.salesforce.com/services/apexrest/your_app_namespace/islicensed", false);
   request.setRequestHeader("Authorization", "OAuth "+sessionId);
   request.setRequestHeader("Content-Type", "application/json");
   request.send();

   // clean up the response
   var getResponse = request.responseText.replace(/\"/g, "");

   // if the user is not licensed, show them noLicense.html
   if (getResponse === “f”){
  	 console.log("No License");      	 
  	 window.location.href="noLicense.html";                               
   }
   // if the user is licensed, show them yesLicense.html
   else {
  	 console.log("Licensed");
  	 window.location.href="yesLicense.html";
   }
}

Make your app customizable

Enterprise customers expect enterprise apps to be configurable to suit their unique requirements. This is also true for enterprise-grade mobile apps. Customers will want to customize an application before distributing it to their employee base. Customizations can include modifying branding and UI themes, configuring business processes, or enabling and disabling feature sets.

You can leverage Custom Settings to create a set of “switches” that define the app configuration. You can then build a simple user interface around these custom settings. Think of this like an admin console, or a central place for admins to manage settings for their users. This provides a centralized, scalable way to distribute customizations to all users.

Here is a simple example of an admin console that lets admins change the background color of the mobile app:

The screenshots below show how the mobile app can read this custom setting and change the display accordingly:

Make your app robust and extensible

There are many ways to make your mobile app more robust and extensible. By developing a custom data model, you instantly enable Salesforce Platform features like reporting, workflow, search, and Chatter.

Defining custom web service methods

The Salesforce Platform instantly enables every object with API services. The APIs allow you to operate on individual objects, but don’t necessarily provide context for the operations. Defining custom web service methods lets you make your app more robust by building business logic into the API calls.

For example, creating a layer of abstraction and exposing a set of app-specific functional APIs will make it easier for your customers to extend your app. You can also use custom web service methods to create a facade. This allows you to create server-side logic and offload specialized or complex calls, such as batching requests to handle low bandwidth, providing transactional support across multiple updates, or working across multiple related database objects..

Conclusion

These are just a few examples of how you can use a managed package to make your mobile app enterprise-grade. Let us know any other ideas you have in the comments.

Have a look at this blog post by Luminix to learn about an ISV’s experience building a package for their mobile app.

A special thanks to Scott Effler and William Yeh from the ISV Technical Enablement team for contributing to this documentation.

tagged , , , , Bookmark the permalink. Trackbacks are closed, but you can post a comment.
  • MaryScotton

    I love the use of Custom Settings to allow mobile app devs to provide customization options for their customers!

    • Naren Raghavan

      Thank you for the feedback!

  • jpaek

    I was just wondering if Mobile SDK for Blackberry 10 is in the works, and if so, what is the timeline for its release.

    Thank you!