Registering Push Devices

Device Management

Device management allows you to register push tokens with Activity Feeds API, which is used to deliver push notifications to user devices.

Device Registration Limits

Each user has a limit of 25 unique devices. Once this limit is reached, the oldest device will be removed and replaced by the new device.

Device Parameters

NameTypeDescriptionDefaultOptional
idstringThe device ID (push token provided by the push provider)-
user_idstringThe user ID for this device-
push_providerstringThe push provider (APN or Firebase)-
disabledbooleanSet if the device is disabledfalse
disabled_reasonstringExplanation if the device is disabled-
push_provider_namestringThe push provider name for multi-bundle configurations-

Register a Device

Register a device to associate it with a user and enable push notifications for activity updates.

Register the user's device for push notifications once your user is successfully connected to Activity Feeds.

Multi-bundle configurations require that you specify a push_provider_name when registering a device that corresponds to the name of the push configuration you've set up in the dashboard.

Multi-Bundle Device Registration

When using multi-bundle configurations, specify the provider name:

// Configure the push provider info during SDK initialization
let notificationsConfig = PushNotificationsConfig(
    pushProviderInfo: PushProviderInfo(
        name: "production-ios",
        pushProvider: .apn
    )
)

let config = FeedsConfig(pushNotificationsConfig: notificationsConfig)
let feedsClient = FeedsClient(
    apiKey: apiKey,
    user: user,
    token: token,
    feedsConfig: config,
    tokenProvider: tokenProvider
)

// Then register the device
try await feedsClient.createDevice(id: pushToken)

List Devices

Get a list of all devices associated with a user.

let devices = try await feedsClient.listDevices()

The device object contains the following properties:

public struct Device {
    public var createdAt: Date
    public var disabled: Bool?
    public var disabledReason: String?
    public var id: String
    public var pushProvider: String
    public var pushProviderName: String?
    public var userId: String
    public var voip: Bool?
}

Remove a Device

Remove a device to stop push notifications for that device.

try await feedsClient.deleteDevice(deviceId: savedToken)

Troubleshooting

If device registration isn't working:

  1. Check your push configuration in the Stream Dashboard
  2. Verify your device token is valid and current
  3. Ensure proper permissions are granted for notifications
  4. Check the push logs in the Stream Dashboard for error messages
  5. Test with different devices to isolate the issue

For more detailed troubleshooting, check the Activity Feeds logs and error responses from the API.