---
title: "Test inline campaigns (Android Views)"
id: "views-based-inline-campaigns-testing"
project: "Contextual Commerce"
url: "https://docs.bazaarvoice.com/articles/contextual-commerce/views-based-inline-campaigns-testing"
updated: 2026-10-15T09:12:56Z
---

# Test inline campaigns \(Android Views\)

This section describes how to validate your integration by forcing inline campaigns to appear in specific locations, ensuring that the component's expansion and collapse behavior does not interfere with your existing UI layouts.
 
 he Contextual Commerce SDK provides a method `Granify.overrideGranifyInlineView `which forces the SDK to use specific locations for display during testing.
 
###  Step 1: Translate labels to JSON

1. Translate the `GranifyInlineViewLabel` set for each location into JSON.

 ![Tip](/resources/Storage/contextual-commerce/bv-global/tip.png)
 The `product_id` field in the JSON is all lowercase and contains an underscore, while the `productId` field in the `GranifyInlineViewLabel` is camel case.
 
2. Target specific products. Include exact `product_id` and `sku` values to test specific items. 
3. Use wildcards for general testing. Set `product_id` and `sku` to `null` to match any `GranifyInlineViewLabel` with the corresponding `name` field.
 
####  Conversion example:

| Kotlin label: | 
Code

```
[Code]  GranifyInlineView(name="aboveProductPhoto", productId="Pants", sku="Green")
```
 |
| --- | --- |
| JSON equivalent (specific): | 
```json
{"name": "aboveProductPhoto", "product_id": "Pants", "sku": "Green"}
```
 |
| JSON equivalent (wildcard): | 
```json
[Code]  {"name": "aboveProductPhoto", "product_id": null, "sku": null} 
```
 |

###  Step 2: Format the JSON array

The label parameter is a string of JSON that correlates to the `GranifyInlineViewLabel` fields.

1. The JSON string is an array of labels rather than just a single label. Enclose objects in brackets `[]`.
2. Order labels by priority. The first label within a page that matches in the list will be used for display.

Code example:
 
Code

```
val overrideLabelString: String = "[{\"name\":\"aboveProductPhoto\",\"product_id\":null,\"sku\":null}]"
```


###  Step 3: Call the override method

1. Call the `Granify.overrideGranifyInlineView(label: String?)` method with the JSON string as the label parameter.
2. Create a text box in a debug menu that calls this method when the JSON object is entered.

### Step 4: Verify the UI

1. Force a match to an inline campaign. Contextual Commerce provides this during installation.
2. Navigate to the page to which the new inline locations have been added.
3. Observe as the campaign displays in the first label that was provided in the array.

### Step 5: Reset testing mode

To reset to the default behavior where Contextual Commerce selects the inline location, call the method with the label parameter set to null.

Reset call:


Code

```
Granify.overrideGranifyInlineView(null)
```


###  Troubleshooting 

* **Campaign won't display:** Check the LogCat output. Ensure you pass the correct `FragmentActivity` into the `Granify.trackPageView(...)` call.
* **Label found but not visible:** Verify your constraints and expand/collapse handlers. The inline may be covered by another element or displayed outside the screen bounds.
* **Poor performance:** Make sure that your expand/collapse handlers are very lightweight. There should be no logging or extraneous calculations within them because they are called on every animation tick.
* **The inline campaign remains visible even when the app is in a restricted state:**This is expected behavior. Inline campaigns operate independently of `Granify.setRestrictionState` and will not be automatically hidden by the SDK when a restricted state is active.

 [![Provide feedback button](/resources/Storage/contextual-commerce/bv-global/topic-footer-2026/provide-feedback-button.png)](https://docs.google.com/forms/d/1qGZ5rApqDrXO_j6vNzcDihDAOPMEjmUr1alHvcEIbQU/edit)