Referral Customization for Android
After you build the Referral Mobile SDK for Android, you can customize the referral UI
components, and modify the referral-related configuration in the MyNTORewards sample app.
UI Customization
The referral UI components are available in the /LoyaltyMobileSDK-Android/SampleApps/MyNTORewards/src/main/java/com/salesforce/loyalty/mobile/myntorewards/views/components package.
For example, to include the Gmail icon as one of the sharing options in the app:
- Add the new Gmail icon in the LoyaltyMobileSDK-Android/SampleApps/MyNTORewards/src/main/res/drawable folder.
- Open the LoyaltyMobileSDK-Android/SampleApps/MyNTORewards/src/main/java/com/salesforce/loyalty/mobile/myntorewards/utilities/ShareType.kt file in Android Studio, and add an entry for Gmail that contains the new icon ID, the Gmail package name, and the INTENT_TYPE_MAIL constant inside the ShareType enum class.
1* This class holds the all possible social media sharing options
2 * To customise the social media icons, change the iconIds configured below
3 * To add new sharing option, add below with iconId, packageName and Intent share type
4 */
5enum class ShareType(@DrawableRes val iconId: Int, val packageName: String?, val intentShareType: String? = ShareType.INTENT_TYPE_TEXT) {
6 FACEBOOK(R.drawable.ic_facebook, ShareType.FACEBOOK_APP_PACKAGE, ShareType.INTENT_TYPE_IMAGE),
7 INSTAGRAM(R.drawable.ic_instagram, ShareType.INSTAGRAM_APP_PACKAGE),
8 WHATSAPP(R.drawable.ic_whatsapp, ShareType.WHATSAPP_APP_PACKAGE),
9 TWITTER(R.drawable.ic_twitter, ShareType.TWITTER_APP_PACKAGE),
10 GMAIL(R.drawable.ic_gmail, ShareType.GMAIL_APP_PACKAGE, ShareType.INTENT_TYPE_MAIL),
11 SHARE_OTHERS(R.drawable.ic_share, null); // Package name is null as its generic sharing option
12
13 companion object {
14 const val INTENT_TYPE_TEXT = "text/plain"
15 const val INTENT_TYPE_IMAGE = "image/*"
16 const val INTENT_TYPE_MAIL = "message/rfc822"
17 const val FACEBOOK_APP_PACKAGE = "com.facebook.katana"
18 const val WHATSAPP_APP_PACKAGE = "com.whatsapp"
19 const val INSTAGRAM_APP_PACKAGE = "com.instagram.android"
20 const val TWITTER_APP_PACKAGE = "com.twitter.android"
21 const val GMAIL_APP_PACKAGE = "com.google.android.gm"
22 }
23}Settings Customization
You can modify the referral program details in the LoyaltyMobileSDK-Android/SampleApps/MyNTORewards/src/main/java/com/salesforce/loyalty/mobile/myntorewards/referrals/ReferralConfig.kt file.
Here are all the properties you can modify.
1/**
2 * Referral configuration class
3 */
4object ReferralConfig {
5 // Referral Program Name
6 const val REFERRAL_PROGRAM_NAME = "NTO Insider"
7 // Configure Referral Promotion Details below, where user can also able to enroll and refer from My Referrals screen
8 const val REFERRAL_DEFAULT_PROMOTION_CODE = "TEMPRP7"
9 const val REFERRAL_DEFAULT_PROMOTION_ID = "0c81Q0000004UL4QAM"
10 // Referral duration - By default, showing the last 90days of referrals info
11 const val REFERRAL_DURATION = 90
12 /* Provided random link here instead of actual Terms and Conditions link.
13 Replace with valid terms and conditions link while using the feature */
14 const val REFERRAL_TANDC_LINK = "https://www.google.co.in/"
15}- REFERRAL_DEFAULT_PROMOTION_CODE and REFERRAL_DEFAULT_PROMOTION_ID: The default promotion code and ID.
- REFERRAL_DURATION: The period in days for which the referral details are to be displayed. By default, the sample app shows the referral information of the last 90 days.
- REFERRAL_PROGRAM_NAME: The default referral program name.
- REFERRAL_TANDC_LINK: An external Terms and Conditions link.
For a complete walkthrough of the referral feature in the MyNTORewards app, see Walkthrough of the Sample App.