---
title: "Android - Utiliser les paywalls de secours"
description: "Gérez les cas où les utilisateurs sont hors ligne ou les serveurs Adapty ne sont pas disponibles."
---

:::warning
Les paywalls de secours sont pris en charge par le SDK Android v2.11 et versions ultérieures.
:::

To maintain a fluid user experience, it is important to set up [fallbacks](/fallback-paywalls) for your flows, [paywalls](paywalls), and [onboardings](onboardings). This precaution extends the application's capabilities in case of partial or complete loss of internet connection.

* **If the application cannot access Adapty servers:**

    It will be able to display a fallback flow or paywall, and access the local onboarding configuration.

* **If the application cannot access the internet:**

    It will be able to display a fallback flow or paywall. Onboardings include remote content and require an internet connection to function.

:::important
Before you follow the steps in this guide, [download](/local-fallback-paywalls) the fallback configuration files from Adapty.
:::

## Configuration \{#configuration\}

1. Déplacez le fichier de configuration de secours dans le répertoire `assets` ou `res/raw` de votre projet Android.
2. Appelez la méthode `.setFallback` **avant** de récupérer le flow, le paywall ou l'onboarding cible.

<Tabs groupId="current-os" queryString>
<TabItem value="kotlin" label="Kotlin" default>
```kotlin showLineNumbers
//if you put the 'android_fallback.json' file to the 'assets' directory
val location = FileLocation.fromAsset("android_fallback.json")
//or `FileLocation.fromAsset("<additional_folder>/android_fallback.json")` if you placed it in a child folder of 'assets')

//if you put the 'android_fallback.json' file to the 'res/raw' directory
val location = FileLocation.fromResId(context, R.raw.android_fallback)

//you can also pass a file URI
val fileUri: Uri = //get Uri for the file with fallback paywalls
val location = FileLocation.fromFileUri(fileUri)

//pass the file location
Adapty.setFallback(location, callback)
```
</TabItem>
<TabItem value="java" label="Java" default>
```java showLineNumbers
//if you put the 'android_fallback.json' file to the 'assets' directory
FileLocation location = FileLocation.fromAsset("android_fallback.json");
//or `FileLocation.fromAsset("<additional_folder>/android_fallback.json");` if you placed it in a child folder of 'assets')

//if you put the 'android_fallback.json' file to the 'res/raw' directory
FileLocation location = FileLocation.fromResId(context, R.raw.android_fallback);

//you can also pass a file URI
Uri fileUri = //get Uri for the file with fallback paywalls
FileLocation location = FileLocation.fromFileUri(fileUri);

//pass the file location
Adapty.setFallback(location, callback);
```
</TabItem>
</Tabs>

Paramètres :

| Paramètre    | Description                                                  |
| :----------- | :----------------------------------------------------------- |
| **location** | L'objet [FileLocation](https://android.adapty.io/adapty/com.adapty.utils/-file-location/-companion/) pour le fichier de configuration de secours |