Cloud Co Op Salesforce Consultants

Steps to Build Successful Native Mobile App on the Salesforce Platform

Are you having a good idea of creating a new mobile app? Have you thought to extend the capabilities of Salesforce’s core products or bring your own product to more customers? Do you want to offer an unrivaled user experience of your native mobile app to your customers by giving them full access to device hardware and extensive offline capability? Well, if you are a startup, well-established software vendor or independent vendor, you can easily figure out how easy and rewarding it is to develop, distribute and sell native mobile applications that can integrate with the Salesforce App Cloud.

In this article, we will be looking at the app development based on Salesforce DX, Scratch Orgs, Salesforce CLI, and the Mobile SDK.

  • Setting up the CLI plugin for mobile SDK

Run the below-given command to get the CLI plugin by the Salesforce mobile team. 

This command is not at all different than the forcereact commands because this acts as a wrapper including all of these commands into a single CLI.

  • Setting up the Workspace

Try using the given command and see the results.

There will be more folders in the project but it will be easy to manage at the end. The force contains Salesforce DX project along with all the associated source and metadata whereas mobile contains a mobile app with the files generated by Mobile SDK. Begin by creating a new project.

Initialize it as a git repo because there exists as a single repo for both the Salesforce project and the mobile app.

Then, create the Salesforce DX project with the help of a script that will output all the values that are required to connect the mobile app for development. Start by creating a sile like a setup.sh and paste the given code to it.

Check it by running the program.

You will get an output something as shown in the figure.

  • Create your Mobile app with Mobile SDK

This specific step is difficult to implement but all the credits go to the Salesforce Mobile SDK team for making it more easier. Open your project folder and input the given CLI command. 

This creates everything which is required to build and run the native mobile apps. In addition to this, the SDK includes some useful stuff to get you going faster. Now, its time to get them connected together.

  • Update the Mobile app for using Scratch Org

Open your Xcode from your targeted tool and select the Xcode workspace in Xcode which you will find it at myproject/mobile/ios/demo1.xcworkspace.Select the AppDelegate.m file and update your RemoteAccessConsumerKey to use the Consumer key and OAuthRedirectURI to use the Callback URL. That’s all you have to do for the coding part. Check it by running the app. Before testing the mobile app in Xcode, if you have built a React Native app then you are required to run npm start for making sure that all react elements are running for the app. The app is ready to run in the Xcode. 

  • Log into the App
  1. Click on ‘Use Custom Domain’ on the login screen.

  1. Paste your Instance URL.

  1. Input the username and password.

  1. Click on the Allow button for using the Connected App to access the API.

  1. And Voila! Your app is ready to work against scratch org. 

Wrap Up

Here, we come to the end of the article. We hope you have well understood the Salesforce DX and the tools that came over. You can take the help of the online tutorials to build other elements using the Salesforce Dx. Till then – keep learning!

Author Bio

Stephanie Donahole is working as a Business Analyst at Tatvasoft Australia, a php web development company in Melbourne, Australia. She loves to write about technology innovation and emergence. Visit website. Follow her on Twitter.