For the complete documentation index, see llms.txt. This page is also available as Markdown.

Push Inbox

Push Inbox Overview

NetmeraInbox allows you to access and manage previously sent push notifications in an inbox-style interface. You cannot instantiate NetmeraInbox directly; instead, you must obtain an instance through the SDK and use it to interact with push notifications.

Filtering Notifications

Create a NetmeraInboxFilter instance to specify which push notifications to fetch. You can filter by:

  • Status: Read, Unread, or Deleted.

  • Categories: Filter by specific categories.

  • Expired Notifications: Include or exclude expired notifications.

  • Page Size: Number of notifications to fetch per request.

Here is a sample code to determine filtering options:

NetmeraInboxFilter filter = new NetmeraInboxFilter.Builder()
        .pageSize(20) // Default: Integer.MAX_VALUE
        .status(NetmeraPushObject.STATUS_ALL) // Default: NetmeraPushObject.STATUS_READ / NetmeraPushObject.STATUS_UNREAD
        .categories(Arrays.asList("category_1", "category_2")) // Default: null
        .includeExpiredObjects(true) // Default: false
        //create filter object from builder
        .build();

Fetching the First Page

Use Netmera.fetchInbox to retrieve notifications that match the filter:

If successful, onFetchInbox will return an inbox object containing push notifications. Otherwise, it will return an error object with failure details.

Filter properties cannot be changed after fetching

To apply new filters, create a new filter object and fetch again:

Fetching Next Pages

Once the first page is retrieved, use mInbox.fetchNextPage() to get additional pages:

Updating Push Notification Status

Notifications can have three states:

  • Unread

  • Read

  • Deleted

Use updateStatus to change a notification's status asynchronously:

You can also update the status of all notifications without fetching them:

Counting Notifications by Status

Retrieve the count of notifications by status:

Handling Push Objects

You can use this method to programmatically trigger the action associated with a push message in the inbox.

  • activity: The current Activity context.

  • pushObject: The NetmeraPushObject instance representing the push message whose action you want to trigger.

Message Categories

The per-channel message category preference APIs described in this section require Netmera Android SDK 4.21.0 or later.

Create message categories from Settings > Messaging & Content > Message Categories in the panel. Each category can be managed per channel (Mobile Push, SMS, Email, WhatsApp, In-App, Web) — so you can track and update a user's opt-in status either for the category as a whole or for one specific channel.

Channels are represented by the NMCategoryChannel enum:

Getting a User's Category Preferences

Fetch the full list of category preferences (ID, name, and opt-in status):

To narrow the result down, pass an NMCategoryPreferenceFilter with a list of category IDs, channels, or both. A category that doesn't support any of the requested channels is left out of the result.

You can also filter by a single category or channel:

Each NMCategoryPreference includes:

  • optInStatus — the overall status: true if the category is enabled on any channel. This is always returned, regardless of channel filters.

  • channelPreferences — a per-channel breakdown, as a list of NMCategoryChannelPreference (channel, optInStatus).

Updating Category Preferences

To turn a category on or off, pass an NMCategoryPreferenceUpdate with the category ID and the new categoryEnabled value:

To update just one channel instead of the whole category, add a channel:

Note: The older Netmera.setUserCategoryPreference(categoryId, categoryEnabled, listener) method still works but is deprecated. It behaves the same as calling the new method without a channel.

Last updated

Was this helpful?