---
source_url: https://www.pubnub.com/docs/sdks/android/api-reference/mobile-push
title: Mobile Push Notifications API for Android SDK
updated_at: 2026-05-25T11:26:57.056Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Mobile Push Notifications API for Android SDK

:::warning Unsupported docs
PubNub no longer maintains Android SDK docs, but our [Java SDK](https://www.pubnub.com/docs/sdks/java) or [Kotlin SDK](https://www.pubnub.com/docs/sdks/kotlin) are fully compatible with the Android platform and you can use them to build mobile apps, ensuring stable software development.
:::

The Mobile Push Notifications feature connects native PubNub publishing to third-party push services. Supported services include Google Android FCM (Firebase Cloud Messaging) and Apple iOS APNs (Apple Push Notification service).

To learn more, read about [Mobile Push Notifications](https://www.pubnub.com/docs/general/push/send).

## Add a device to a push notifications channel

:::note Requires Mobile Push Notifications add-on
Enable Mobile Push Notifications for your key in the [Admin Portal](https://admin.pubnub.com/). See how to [enable add-on features](https://support.pubnub.com/hc/en-us/articles/360051974791-How-do-I-enable-add-on-features-for-my-keys-).
:::

Enable mobile push notifications on a set of channels.

### Method(s)

```java
pubnub.addPushNotificationsOnChannels()
    .pushType(PNPushType)
    .channels(List<String>)
    .deviceId(String)
    .topic(String)
    .environment(PNPushEnvironment)
```

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| pushType | PNPushType | Yes |  | Push type. One of: `PNPushType.FCM`, `PNPushType.APNS`, `PNPushType.APNS2`. |
| channels | List<String> | Yes |  | Channels to enable for push notifications. |
| deviceId | String | Yes |  | Device token used for push notifications. |
| topic | String | Optional |  | APNs topic (bundle identifier). Required for APNS2. |
| environment | PNPushEnvironment | Optional |  | APNs environment. Required for APNS2. |
| async | PNCallback<PNPushAddChannelResult> | Optional |  | Callback of type `PNPushAddChannelResult`. |

### Sample code

#### Add device to channel

```java
// for FCM/GCM
pubnub.addPushNotificationsOnChannels()
    .pushType(PNPushType.FCM)
    .channels(Arrays.asList("ch1", "ch2", "ch3"))
    .deviceId("googleDevice")
    .async(new PNCallback<PNPushAddChannelResult>() {
        @Override
        public void onResponse(PNPushAddChannelResult result, PNStatus status) {
            // handle response.
        }
    });

// for APNS2
pubnub.addPushNotificationsOnChannels()
    .pushType(PNPushType.APNS2)
    .channels(Arrays.asList("ch1", "ch2", "ch3"))
    .deviceId("appleDevice")
    .topic("myapptopic")
    .environment(PNushEnvironment.PRODUCTION)
    .async(new PNCallback<PNPushAddChannelResult>() {
        @Override
        public void onResponse(PNPushAddChannelResult result, PNStatus status) {
            // handle response.
```

### Returns

No payload is returned. Check `status.isError()` on the status object.

## List push notifications channels for a device

:::note Requires Mobile Push Notifications add-on
Enable Mobile Push Notifications for your key in the [Admin Portal](https://admin.pubnub.com/). See how to [enable add-on features](https://support.pubnub.com/hc/en-us/articles/360051974791-How-do-I-enable-add-on-features-for-my-keys-).
:::

Get all channels with push notifications for the specified push token.

### Method(s)

```java
pubnub.auditPushChannelProvisions()
    .pushType(PNPushType)
    .deviceId(String)
    .topic(String)
    .environment(PNPushEnvironment)
```

| Parameter | Description |
| --- | --- |
| `pushType` *Type: `PNPushType` | Push type. One of: `PNPushType.FCM`, `PNPushType.APNS`, `PNPushType.APNS2`. |
| `deviceId` *Type: `String` | Device token used for push notifications. |
| `topic`Type: `String` | APNs topic (bundle identifier). Required for APNS2. |
| `environment`Type: `PNPushEnvironment` | APNs environment. Required for APNS2. |
| `async`Type: `PNCallback<PNPushListProvisionsResult>` | Callback of type `PNPushListProvisionsResult`. |

### Sample code

#### List channels for device

```java
// for FCM/GCM
pubnub.auditPushChannelProvisions()
    .deviceId("googleDevice")
    .pushType(PNPushType.FCM)
    .async(new PNCallback<PNPushListProvisionsResult>() {
        @Override
        public void onResponse(PNPushListProvisionsResult result, PNStatus status) {

        }
    });

// for APNS2
pubnub.auditPushChannelProvisions()
    .deviceId("appleDevice")
    .pushType(PNPushType.APNS2)
    .topic("myapptopic")
    .environment(PNPushEnvironment.PRODUCTION)
    .async(new PNCallback<PNPushListProvisionsResult>() {
        @Override
        public void onResponse(PNPushListProvisionsResult result, PNStatus status) {

        }
    });
```

### Returns

Returns `PNPushListProvisionsResult` with:

| Method | Description |
| --- | --- |
| `getChannels()`Type: `List<String>` | Channels associated with push notifications. |

## Remove a device from push notifications channels

:::note Requires Mobile Push Notifications add-on
Enable Mobile Push Notifications for your key in the [Admin Portal](https://admin.pubnub.com/). See how to [enable add-on features](https://support.pubnub.com/hc/en-us/articles/360051974791-How-do-I-enable-add-on-features-for-my-keys-).
:::

Disable push notifications on selected channels.

### Method(s)

```java
pubnub.removePushNotificationsFromChannels()
    .pushType(PNPushType)
    .deviceId(String)
    .topic(String)
    .environment(PNPushEnvironment)
```

| Parameter | Description |
| --- | --- |
| `pushType` *Type: `PNPushType` | Push type. One of: `PNPushType.FCM`, `PNPushType.APNS`, `PNPushType.APNS2`. |
| `channels` *Type: `List<String>` | Channels to disable for push notifications. |
| `deviceId` *Type: `String` | Device token used for push notifications. |
| `topic`Type: `String` | APNs topic (bundle identifier). Required for APNS2. |
| `environment`Type: `PNPushEnvironment` | APNs environment. Required for APNS2. |
| `async`Type: `PNCallback<PNPushRemoveChannelResult>` | Callback of type `PNPushRemoveChannelResult`. |

### Sample code

#### Remove device from channel

```java
// for FCM/GCM
pubnub.removePushNotificationsFromChannels()
    .deviceId("googleDevice")
    .channels(Arrays.asList("ch1", "ch2", "ch3"))
    .pushType(PNPushType.FCM)
    .async(new PNCallback<PNPushRemoveChannelResult>() {
        @Override
        public void onResponse(PNPushRemoveChannelResult result, PNStatus status) {

        }
    });

// for APNS2
pubnub.removePushNotificationsFromChannels()
    .deviceId("appleDevice")
    .channels(Arrays.asList("ch1", "ch2", "ch3"))
    .pushType(PNPushType.APNS2)
    .topic("myapptopic")
    .environment.(PNPushEnvironment.PRODUCTION)
    .async(new PNCallback<PNPushRemoveChannelResult>() {
        @Override
        public void onResponse(PNPushRemoveChannelResult result, PNStatus status) {

        }
    });
```

### Returns

No payload is returned. Check `status.isError()` on the status object.

## Remove a device from all push notifications channels

:::note Requires Mobile Push Notifications add-on
Enable Mobile Push Notifications for your key in the [Admin Portal](https://admin.pubnub.com/). See how to [enable add-on features](https://support.pubnub.com/hc/en-us/articles/360051974791-How-do-I-enable-add-on-features-for-my-keys-).
:::

Disable push notifications from all channels registered for the specified push token.

### Method(s)

```java
pubnub.removeAllPushNotificationsFromDeviceWithPushToken()
    .pushType(PNPushType)
    .deviceId(String)
    .topic(String)
    .environment(PNPushEnvironment)
```

| Parameter | Description |
| --- | --- |
| `pushType` *Type: `PNPushType` | Push type. One of: `PNPushType.FCM`, `PNPushType.APNS`, `PNPushType.APNS2`. |
| `deviceId` *Type: `String` | Device token used for push notifications. |
| `topic`Type: `String` | APNs topic (bundle identifier). Required for APNS2. |
| `environment`Type: `PNPushEnvironment` | APNs environment. Required for APNS2. |
| `async`Type: `PNCallback<PNPushRemoveAllChannelsResult>` | Callback of type `PNPushRemoveAllChannelsResult`. |

### Sample code

#### Remove all mobile push notifications

```java
// for FCM/GCM
pubnub.removeAllPushNotificationsFromDeviceWithPushToken()
    .deviceId("googleDevice")
    .pushType(PNPushType.FCM)
    .async(new PNCallback<PNPushRemoveAllChannelsResult>() {
        @Override
        public void onResponse(PNPushRemoveAllChannelsResult result, PNStatus status) {

        }
    });

// for APNS2
pubnub.removeAllPushNotificationsFromDeviceWithPushToken()
    .deviceId("appleDevice")
    .pushType(PNPushType.APNS2)
    .topic("myapptopic")
    .environment(PNPushEnvironment.PRODUCTION)
    .async(new PNCallback<PNPushRemoveAllChannelsResult>() {
        @Override
        public void onResponse(PNPushRemoveAllChannelsResult result, PNStatus status) {

        }
    });
```

### Returns

No payload is returned. Check `status.isError()` on the status object.

## Terms in this document

* **Channel** - A pathway for sending and receiving messages between devices, created automatically when you first use it, that can handle any number of users and messages for different communication needs, like 1-1 text chats, group conversations, and other data streaming.
* **PubNub** - PubNub is a real-time messaging platform that provides APIs and SDKs for building scalable applications. It handles the complex infrastructure of real-time communication, including: Message delivery and persistence, Presence detection, Access control, Push notifications, File sharing, Serverless processing with Functions and Events & Actions, Analytics and monitoring with BizOps Workspace, AI-powered insights with Illuminate.
* **Push token** - A device identifier issued by a push provider (APNs or FCM) used to register a device for receiving mobile push notifications.
