Device Token Registration Service
Component Detail
Service Layer
high complexity
mobile
1
Dependencies
0
Dependents
0
Entities
0
Integrations
Description
Flutter-side service managing the complete lifecycle of FCM and APNs device tokens. Registers tokens on login, subscribes to onTokenRefresh to sync updated tokens immediately, and invalidates tokens on sign-out or detected reinstall to prevent delivery failures.
device-token-registration-service
Responsibilities
- Register the device push token with the backend immediately after successful authentication
- Subscribe to the firebase_messaging onTokenRefresh callback and sync the new token to the backend
- Invalidate and delete the device token from the backend on user sign-out
- Handle platform-specific token acquisition for Android FCM and iOS APNs
- Detect app reinstall scenarios and force re-registration of new tokens
Interfaces
registerToken(userId, token, platform)
refreshToken(userId, newToken)
invalidateToken(userId, deviceId)
getCurrentToken()
listenForTokenRefresh()