# Customizing notifications

### Custom small notification icon

Small icons appear in the Android notification bar and allow users to recognize your app when they receive a notification. Before releasing a new version of your app on the Store, you should make sure you've set a custom small icon for your notifications.

![Small icon samples](/files/8V5vyR1wAGdJTadnegBN)

The small icon should be **opaque white**, using only the alpha channel and **24x24dp**. You can easily create one using the [Android Assets Studio](https://romannurik.github.io/AndroidAssetStudio/icons-notification#source.space.trim=1\&source.space.pad=0\&name=ic_stat_example).

If you use a colored small icon, Android will display it as a white square:\ <br>

<figure><img src="/files/lOPyIXUPqot7vEe7ZhVN" alt=""><figcaption><p>Small icon with issue</p></figcaption></figure>

In order to set it up with Batch Push, you have to do three things:

{% stepper %}
{% step %}
**Step 1.**

Put your small icon drawables in the Android project's `res` folder, for all screen densities. Your projet folder architecture should look like that:

```json
res
 ├── drawable-hdpi
 │   └── ic_notification_icon.png
 ├── drawable-mdpi
 │   └── ic_notification_icon.png
 ├── drawable-xhdpi
 │   └── ic_notification_icon.png
 └── drawable-xxhdpi
     └── ic_notification_icon.png
```

{% endstep %}

{% step %}
**Step 2.**

Once you did that, [add the following in your manifests'](/developer/sdk/cordova/advanced/android-manifest-manipulation.md) `<application>` tag:

```xml
<meta-data
            android:name="com.batch.android.push.smallicon"
            android:resource="@drawable/ic_notification_icon" />
```

Your notifications will now automatically use that icon. Please note that you are not forced to use `ic_notification_icon` for the icon's name. The name in the manifest simply needs to match the filenames.
{% endstep %}

{% step %}
**Step 3.**

For your Android 5.0 users *(and newer)*, you should set a color to your notification, which will be shown behind the small icon.

![Accent color](/files/AK7Iz8jA6i6Mu4SDtVM8)

Simply [add this in your manifest](https://github.com/BatchLabs/product.tech-documentation-gitbook/blob/master/cordova/advanced/android-manifest-manipulation/README.md), just like the small icon metadata:

```xml
<meta-data
    android:name="com.batch.android.push.color"
    android:value="#FF00FF00" />
```

You can also use `android:resource` instead of `android:value` and point to a color defined in an XML ressource file.
{% endstep %}
{% endstepper %}

### Disabling foreground notifications

By default, the Batch Cordova plugin will always show foreground notifications on both platforms and will trigger a `batchPushReceived` event when tapped.

The SDK exposes a method on the `push` module to change this behaviour on iOS:

```js
// This should be right after batch.start()
batch.push.setiOSShowForegroundNotifications(false);
```

On Android, simply add the following to your manifest:

```xml
<meta-data android:name="com.batch.android.push.foreground_push_handling" android:value="true" />
```

{% hint style="warning" %}
Disabling foreground notifications will automatically trigger mobile landings when attached to a push received while the App is in foreground.
{% endhint %}

### Managing Android notification display

You can restrict notification display on Android by calling :

```js
batch.push.setAndroidShowNotifications(false);
```

#### Re-enabling notifications:

```js
batch.push.setAndroidShowNotifications(true)
```

{% hint style="info" %}
Batch will remember this value, even if your Application reboots. You can ask to Batch whether notifications are disabled or not with : `batch.push.shouldShowAndroidNotifications()` .
{% endhint %}

### Managing iOS notification display

Just like Android, you can set the notification types you want on iOS.

The enum is `batch.push.iOSNotificationTypes`, and contains *BADGE*, *SOUND*, *ALERT*.

For example, if you want to disable sound:

```cs
batch.push.setiOSNotificationTypes(batch.push.iOSNotificationTypes.ALERT |
                                    batch.push.iOSNotificationTypes.BADGE);
```

{% hint style="info" %}
Since this setting affects what the user will be asked to allow in the iOS notification request popup, this should be done before you call `batch.push.registerForRemoteNotifications()`.
{% endhint %}


---

# Agent Instructions: 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:

```
GET https://doc.batch.com/developer/sdk/cordova/advanced/customizing-notifications.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
