Get Started with Salesforce Mobile SDK
After completing this unit, you'll be able to:
- Understand the various models (native, HTML, and hybrid) for Salesforce Mobile SDK app development.
- Compare the relative advantages and disadvantages of each approach.
In a short time, mobile devices have become indispensable to our personal and professional lives. People of every stripe create and consume data on an ever-increasing variety of connected devices. Workers use smart devices to stay in touch with each other, make deals with customers, and engage the public on social networks.
To meet the challenge of running businesses on mobile devices, Salesforce provides the Salesforce Platform. This platform guarantees enterprise-grade reliability, availability, and security across a wide range of mobile technology.
- The Salesforce app, available on Apple AppStore and Google Play Store, delivers the fastest way for Salesforce platform administrators and developers to build and deliver apps for employees. It offers simple point-and-click tools for administrators and the Lightning web development platform for advanced developers. This trail doesn’t address Salesforce application development.
- Salesforce Mobile SDK gives developers the tools to build mobile applications with customized user experiences. Mobile SDK lets you produce stand-alone custom apps that you distribute through the Apple App Store or Google Play Store. These apps can target employees, customers, or partners. You can choose native or web technologies to build these apps while enjoying the same grade of reliability and security found in the Salesforce app.
In this module, you’ll get started with Mobile SDK app development.
- Enterprise Identity & Security
- Mobile SDK includes a complete implementation of Salesforce Connected App Policy, so that all users can access their data securely and easily. It supports SAML and advanced authentication flows so that administrators always have full control over data access.
- SmartStore Encrypted Database
- Mobile databases are useful for building highly responsive apps that also work in any network condition. SmartStore provides an easy way to store and retrieve data locally while supporting a flexible data model. It also uses AES-256 encryption to ensure that your data is always protected.
- SmartSync Data Framework
- SmartSync Data Framework provides a simple API for synchronizing data between your offline database and the Salesforce cloud. With SmartSync Data Framework, developers can focus on the UI and business logic of their application while leaving the complex synchronization logic to Mobile SDK.
- Mobile Services
- Mobile SDK supports a wide range of platform mobile services, including push notifications, geolocation, analytics, collaboration tools, and business logic in the cloud. These services can supercharge your mobile application and also reduce development time.
- Salesforce Communities
- With Salesforce Communities and Mobile SDK, developers can build mobile applications that target their customers and partners. These applications benefit from the same enterprise features and reliability as employee apps.
- Native and Hybrid, iOS and Android
- Mobile SDK lets you choose any technology (native, React Native, or Cordova-based hybrid apps) on iOS and Android.
- Native apps are specific to a given mobile platform (iOS or Android). These apps use the development tools and languages that the respective platform supports. For example, you develop iOS apps in Xcode using Objective-C or Swift. Native apps look and perform best but require the most development effort.
- Hybrid apps combine the ease of HTML5 web app development with the power of the native platform by wrapping a web app inside the Salesforce container. This combined approach produces an application that accesses the device’s native capabilities and is delivered through the app store. You can also create hybrid apps using Visualforce pages delivered through the Salesforce hybrid container.
Native apps provide the best usability, the best features, and the best overall mobile experience. There are some things you get only with native apps:
- Fast graphics API—The native platform gives you the fastest graphics. This advantage comes into play, for example, if you’re using larges quantities of data and require a fast refresh.
- Fluid animation—Related to the fast graphics API is the ability to have fluid animation. This ability is especially important in gaming, highly interactive reporting, or intensely computational algorithms for transforming photos and sounds.
- Built-in components—The camera, address book, geolocation, and other features native to the device can be seamlessly integrated into mobile apps. Another important built-in component is encrypted storage, but more about that later.
- Ease of use—The native platform is what people are accustomed to. When you add that familiarity to the native features they expect, your app becomes that much easier to use.
- Proven APIs and frameworks
- Painless special effects through established components
- Maintaining all your code in one place
An HTML5 mobile app is essentially one or more web pages that are designed to work on a small mobile device screen. As such, HTML5 apps are device agnostic and can be opened with any modern mobile browser. Because your content is on the web, it’s searchable, which can be a huge benefit for certain types of apps (shopping, for example).
Getting started with HTML5 is easier than with native or hybrid development. Unfortunately, every mobile device seems to have its own idea of what constitutes usable screen size and resolution. This diversity imposes an extra burden of testing on different devices and different operating systems.
An important part of the "write once, run anywhere" HTML5 methodology is that distribution and support are much easier than for native apps. Need to make a bug fix or add features? Done and deployed for all users. Native app, on the other hand, require longer development and testing cycles. Furthermore, customers typically have to log in to an app store to get new versions.
- No secure offline storage—HTML5 browsers support offline databases and caching, but with no out-of-the-box encryption support. You get all three features in Mobile SDK native applications.
- Unfriendly security features—Trivial security measures can pose complex implementation challenges in mobile web apps. They can also be painful for users. For example, a web app with authentication requires users to enter their credentials every time the app restarts or returns from a background state.
- Limited native features—The camera, address book, and other native features are accessible on few, if any, browser platforms.
- Lack of native look and feel—HTML5 can only emulate the native look, and customers can’t use familiar compound gestures.
- Model, query, search, and edit Salesforce data.
- Securely cache Salesforce data for offline use.
- Synchronize locally cached data with the Salesforce server.
You know that native apps are installed on the device, while HTML5 apps reside on a web server. Perhaps you’re wondering whether hybrid apps store their files on the device or on a server. Great question! The storage location depends on whether your hybrid app is local or remote.
- Alternatively, you can implement the full web application from the server (with optional caching for better performance). Your container app retrieves the full application from the server and displays it in a native web view.
Both types of hybrid development are covered here.
React Native Apps
- SmartSync Data Framework
- Salesforce login and authentication
- Salesforce REST API access.
Mobile Architecture Comparison
The following table shows how the various development scenarios stack up.
|Native, React Native||HTML5||Hybrid|
|Graphics||Native APIs||HTML, Canvas, SVG||HTML, Canvas, SVG|
|Look and feel||Native||Emulated||Emulated|
|Distribution||App store||Web||App store|
|Offline storage||Secure file system||Not secure; shared SQL, Key-Value stores||Secure file system; shared SQL (through Cordova plug-ins)|
|Connectivity||Online, offline||Mostly online||Online, offline|
- Native, HTML5, or Hybrid: Understanding Your Mobile Application Development Options (Salesforce Developers Technical Library)
- https://developer.salesforce.com/mobile/resources (Mobile Services Resources)
- Salesforce Rollout: Getting Started with Mobile