function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Michael SomervilleMichael Somerville 

How to Integrate Mobile SDK into an existing Android Project


I have an exisiting Android application that I would like to extend to include the ability to create new Leads in SFDC.
So far all the documentation and tutorials I have found regarding the SFDC Mobile SDK assume that you are creating a new project.

This is deffinitely NOT what I want to do and would love some pointer to docs or direct support on how to best accomplish this.

I would like to take advantage of the Mobile SDK's OAuth Authentication handling and session managment features, but my app's workflow is really a simple push new lead to SFDC approach. I am thinking that this should be fairly straight forward once I overcome this initial block.
I also do NOT want to force a login to SFDC at application start. The ablity to push new Leads to SFDC is one of serveral optional features, and therefore it is approapriate to ask for credentials only after the end-user engages this option.

Thanks in advance

Steve ThistleSteve Thistle

Hi Michael, 
Starting in 5.0 the mobile sdk began publishing to jcenter. This should make things significantly easier for you. 

Here are some steps that should get you started assuming you are using gradle & android studio.
1) Ensure jcenter() is included in your porject repositiory list
2) Add compile "com.salesforce.mobilesdk:SalesforceSDK:5.1.0" to your build.gradle
3) Define an account type in your strings.xml <string name="account_type"></string> 
4) Initialize the mobile sdk at application start:
SalesforceSDKManager.initNative(this, new SalesforceSDKManager.KeyInterface() {
//Your key manager interface implementation here.
} , YourMainActivity.class);

I also found this article which explains how to defer login until it is needed. I have never tried it so I can't attest to the results.

Here is a link to the mobile sdk google+ community - You can ask the development team questions here and they may be able to provide insight/help.

Michael SomervilleMichael Somerville
Hi Steve;

Thanks for the feedback and suggestions. I'll check them out and provide feedback on the outcome for the benefit of thers seeking the same solution.
Rajat raiRajat rai
Hi you can visit for more information