> For the complete documentation index, see [llms.txt](https://legacy-docs.usesmileid.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://legacy-docs.usesmileid.com/integration-options/mobile/react-native/consent-screen.md).

# Consent Screen

On android the screen is instantiated as a dialog on top of your app and on iOS the screen is instantiated as a view controller so it is important to take this into consideration if you have any navigation that is expected before or after the consent screen has been shown

### Show the dialog

```
RnSmileId.requestConsent("<TAG>", "<COMPANY_LOGO>",<BUNDLE_ID/PACKAGE_NAME>,
<COMPANY_NAME>, <PRIVACY_URL>);
```

* TAG \<STRING>This is important that it matches the same tag which may have been or will be used to capture the selfie and or id card document as it will determine if the job will be submitted or not when consent is required for the id type
* COMPANY\_LOGO \<STRING> This is a string typically the app icon name it has to be the name of an image resource in your res folder for android and or in your assets for iOS, so the user is familiar with what they will finally see which the SDK will present on the consent screen. Ideal sizes for this resource are\
  48x48 mdpi\
  72x72 hdpi

  96x96 xhdpi

  144x144 xxhdpi

  192x192 xxxhdpi
* BUNDLE\_ID/PACKAGE\_NAME \<STRING> This is your app's bundle id on iOS and your app's package name on android, this will be used to fetch the resources to be shown on the consent screen
* COMPANY\_NAME \<STRING>This is the company name that will be presented on the consent screen
* PRIVACY\_URL \<STRING> This is a link to a valid web page that contains your company's privacy policy the user can click this and view the privacy policy.

The consent screen will be shown and this code runs asynchronously and will show the below screens for iOS and android and will return a hashmap which containts a key `SID_RESULT_CODE` anything other than -1 means it the user has declined consent and -1 means the user agreed to consent and you may proceed as normal

![ANDROID](/files/tOY6NXnAVzUFdyvfXp9M) ![iOS](/files/49jgt5LWkDOoHhWahy92)

## BVN Consent Screen

The SDK has prebuilt screens to request consent from a user before running a job with the BVN ID Type.

The screen is instantiated as a activity so it is important to take this into consideration if you have any navigation that is expected and whether to show it from a fragment or from an activity.

### Android Setup

#### Step 1

Add a theme in your app's styles which looks like the below

```
<style name="AppTheme.NoActionBar">
  <item name="windowActionBar">false</item>
  <item name="windowNoTitle">true</item>
  <item name="android:windowSoftInputMode">adjustResize</item>
</style>
```

#### Step 2

Declare the smile id consent activities in your app's android manifest

```
<activity
    android:name="com.smileidentity.libsmileid.core.consent.ConsentActivity"
    android:exported="false"
    android:theme="@style/AppTheme.NoActionBar" />

<activity
    android:name="com.smileidentity.libsmileid.core.consent.bvn.ui.activities.ConsentBVNNumberActivity"
    android:exported="false"
    android:theme="@style/AppTheme.NoActionBar" />

<activity
    android:name="com.smileidentity.libsmileid.core.consent.bvn.ui.activities.ConsentBVNContactMethodActivity"
    android:exported="false"
    android:theme="@style/AppTheme.NoActionBar" />

<activity
    android:name="com.smileidentity.libsmileid.core.consent.bvn.ui.activities.ConsentOTPVerificationActivity"
    android:exported="false"
    android:theme="@style/AppTheme.NoActionBar" />
```

#### Show Consent

Show the consent when ready

```
try {
RnSmileId.requestBVNConsent(<TAG>, <ID_TYPE>, <COMPANY_NAME>,
    <YOUR_COMPANY_LOGO>,"<BUNDLE_ID/PACKAGE_NAME>",
    <PRIVACY_POLICY_URL>, <ENVIRONMENT>);
} catch (e) {
//  e will contain an error code and a message for the failure
}
```

{% hint style="info" %}
If `ENVIRONMENT` is set to `false` (for sandbox), enter the following on the screen for BVN and OTP:\
\
BVN: 00000000000\
OTP: 000000\
\
Any other BVN or OTP will return invalid errors
{% endhint %}

| Variable                    | Description                                                                                                                                    |
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| TAG                         | This is a local unique job identifier which you can use to identify the end to end process for this job which should be an alphanumeric string |
| ID\_TYPE                    | Can be BVN or BVN\_MFA the user will be shown BVN as the id type they are consenting to                                                        |
| COMPANY\_NAME               | The company name to be shown to the user                                                                                                       |
| COMPANY\_LOGO               | The company logo to be shown to the user                                                                                                       |
| \<BUNDLE\_ID/PACKAGE\_NAME> | You apps package name for android or bundle id for iOS                                                                                         |
| ENVIRONMENT                 | `true` for production and `false` for sandbox                                                                                                  |
| PRIVACY\_POLICY             | A valid url to your company's privacy policy                                                                                                   |

#### Getting Results

If the consent flow succeeds then it returns a promise with an object with key value maps and which will contain

`<SID_RESULT_CODE>` This will be 1 for success and 0 for failed\
\
**SUCCESS STATE**\
`<TAG>` the tag used to identify the end to end process for this job which should be an alphanumeric string\
`<BVNNUMBER>` the user entered BVN number\
`<SESSION_ID>` the session\_id which should be sent together with the userIdInfo with a key session\_id and this value\
\
**FAILED STATE**\
`<ERROR_VALUE>` The reason for the failure\
`<TAG>` The tag used to request consent\\

If for any reason the consent flow fails the catch block will return an exception with an error code and an error message

Possible ERROR\_VALUE are

* 777 Missing partner name
* 778 Missing partner Logo
* 779 Error with your configuration please check documentation
* 780 User declined consent summary
* 781 A network error occurred
* 782 An error occurred with auth smile
* 783 An error occurred after inputing the BVN number this may be the user entered an invalid BVN error or there was a connection issue whilst initiating consent
* 784 An error occurred after selecting the mode (sms/email) or the user clicked this is likely a network or server error
* 785 An error occurred because the presented mode of confirmation are no longer valid for the user so they clicked these are invalid
* 786 An error occurred during OTP validation

This will present the below screens

#### BVN Consent Summary Screen

<figure><img src="/files/XbizloZMLW5eTc5tudS5" alt=""><figcaption></figcaption></figure>

#### BVN Number Screen

<figure><img src="/files/ARYSsgUGEHlSzLcu2k5y" alt=""><figcaption></figcaption></figure>

#### BVN Mode Selection Screen

<figure><img src="/files/orOtTPd90Zql5YhlEYhj" alt=""><figcaption></figcaption></figure>

#### BVN OTP Screen

<figure><img src="/files/D33A6PCHURq3wZ0mudVw" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://legacy-docs.usesmileid.com/integration-options/mobile/react-native/consent-screen.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
