Import SDK into Android Studio
After you clone the mobile SDK for Android repository, import Loyalty Management Mobile SDK in Android Studio to automatically download and manage external dependencies.
| Required Editions |
|---|
| Available in: all editions that have Loyalty Management enabled |
-
Unzip the
LoyaltyMobileSDK-Androidpackage that you downloaded. -
Open Android Studio.
-
Go to File | New | Import Project, and then select the
LoyaltyMobileSDK-Androidfolder. -
Click Open.
-
Open the
SampleApps/MyNTORewards/build.gradlefile and under Dependencies block, to the first line of Dependencies, add:{implementation fileTree(dir: 'libs', include: ['*.jar']) implementation project(path: ':Sources') } -
Open the
SampleApps/MyNTORewards/connectedapp.properties.samplefile and modify the properties of the connected app as per your org. -
Rename the
connectedapp.properties.samplefile toconnectedapp.properties. -
Click Sync Now.
Android Studio automatically downloads and manages external dependencies for the Mobile SDK and the Sample App.
-
Open the SDK files and ensure that the files include the appropriate SDK packages.
If the sync fails, disconnect the VPN to ensure there’s no blocker when downloading the dependencies, and then resync.
-
Add the code snippet to add the appropriate SDK package:
import com.salesforce.loyalty.mobile.sources.forceUtils.* import com.salesforce.loyalty.mobile.sources.loyaltyAPI.* import com.salesforce.loyalty.mobile.sources.loyaltyModels.* import com.salesforce.loyalty.mobile.sources.loyaltyExtensions.*
You can now use the classes and structures in the LoyaltyMobileSDK-Android module and API references to manage the features in your application.