Skip to main content

Advanced

Theming

A custom theme can be created that can overrides any theme attribute. The theme must either have a parent of Theme.LoopMediaGroup or implement every theme attribute defined in that theme.

When initially configuring the SDK pass your theme id into the Configuration object so that all SDK fragments and activities will use the custom theme instead of the default theme.

override fun onCreate() {
super.onCreate()
// Configure LMG SDK

val configuration = Configuration.Builder()
.setTheme(R.style.MyAppTheme)
.setLoggerLevel(LoggerLevel.Verbose)
.build();

LoopMediaGroup.init(integrationKey, this, configuration)
}

See Theme.LoopMediaGroup for the list of all attributes that can be overridden.

Offers

Sent notification or direct link must have offer id or offer slug available. Optionally a locationId can be used to focus on a specific location.

Displaying offer details

import com.loopmediagroup.ui.offerdetails.OfferDetailsActivity
startActivity(OfferDetailsActivity.createIntent(this, "offerId"))

Displaying offer details with focus on a specific location.

import com.loopmediagroup.ui.offerdetails.OfferDetailsActivity
import com.loopmediagroup.domain.data.Location
startActivity(OfferDetailsActivity.createIntent(this, "offerId", location))

Where location is an object instance of Location class

Business or Location

Sent notification or direct link must have business id, business slug, location slug available.

Displaying Business details

Business Details will display all locations and offers for a business based on the current SDK content filters. Use this view when there are potentially many locations with different offers available for the current user settings.

import com.loopmediagroup.ui.businessdetails.BusinessDetailsActivity
startActivity(BusinessDetailsActivity.createIntent(this, "businessId"))

Displaying Location details

Location Details shows the details and offers for a single business location.

import com.loopmediagroup.ui.locationdetails.LocationDetailsActivity
startActivity(LocationDetailsActivity.createIntent(this, "businessId", "locationId"))

Icons

In order to change icons in the SDK, images resources must be provided with the same resource ids as the built-in icon.

Language Localization

In order to add support for additional language translations or override existing english strings, a string resource file must be defined in main\res\values-{language}\strings.xml and ALL SDK string keys must be defined.

Managing Navigation

Once an SDK view is initialized and presented, the SDK manages navigation to other views automatically. In some cases, this navigation behaviour needs to be customized for an integration. For example, if the integration provides custom business listing screens, it may want to override the default behaviour when a Business view is tapped. The SDK allows an integration to intercept, stop, or otherwise customize internal navigation actions via a Navigation Listener.

Navigation Listener is an object that implements the ClientNavigationListener interface. ClientNavigationListener specifies one method, onPendingActivity(pendingIntent: Intent, context: Context, data: Map<String, Any>?): Intent?.

This method allows you to inspect the pending Intent and choose what to present.

onPendingActivity is called before each navigation action initiated by an SDK managed view. It allows you to customize navigation by returning different values:

  • Return the pendingIntent Intent. This is the default navigation behaviour.
  • Return a custom Intent. This will navigate to your custom destination based on the provided Intent.
  • Return nil. This cancels navigation. Can be used to prevent certain views from being shown, or to fully customized the navigation behaviour of a custom Intent.

Exceptions

While almost all SDK-initiated navigation is customizable via the Navigation Listener, there are exceptions, primarily the Offer Redemption flow.

Offer Redemption is a complex process that potentially involves a number of different steps and screens. As these are all required to support all the different offer features and use-cases, observing, interrupting, or cancelling these screens via the Navigation Listener is not permitted.

Example Implementation

Example of implementation onPendingActivity(pendingIntent: Intent, context: Context, data: Map<String, Any>?): Intent? listener method:

LoopMediaGroup.client().navigationListener = object : ClientNavigationListener {
override fun onPendingActivity(pendingIntent: Intent, context: Context, data: Map<String, Any>?): Intent? {
if (pendingIntent.component?.className == "com.loopmediagroup.ui.businessdetails.BusinessDetailsActivity") {
// Prevent from any navigation when Business Details Activity should be shown
return null
} else if (pendingIntent.component?.className == "com.loopmediagroup.ui.collection.CollectionActivity") {
// Showing custom Activity (EmptyActivity) when Collection Activity should be shown
return Intent(context, EmptyActivity::class.java)
}

return pendingIntent;
}
}

SDK Configuration Options

SDK has some configurations that are optional for the integration:

  • Ability to save offers when user is identified
  • Ability to share offers and businesses
  • Ability to show Powered by GetintheLoop badge on redemption details
  • Ability to show visual effects like confetti
  • Ability to show feedback and support links on businesses and offers details.
  • Ability to set the email adress for feedback and support
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Default to false -->
<bool name="lmg_showBookmarkAction">true/false</bool>
<bool name="lmg_showShareAction">true/false</bool>

<!-- Default to true -->
<bool name="lmg_showPoweredByGetintheLoopBadge">true/false</bool>
<bool name="lmg_visualEffectsEnabled">true/false</bool>
<bool name="lmg_supportLinksEnabled">true/false</bool>

<!-- Default to support@loopmediagroup.com -->
<string name="lmg_supportEmailAddress">support@email.com</string>
</resources>
note

The Powered by GetintheLoop badge MUST be enabled if you are showing offers provided by GetintheLoop.