Push Notifications
Configure Apple Push Notifications (APNs) and Firebase Cloud Messaging for push notifications
Push notification provider support is coming soon. This documentation describes the planned functionality.
Lunogram supports sending push notifications to both major mobile platforms:
- APNs - Apple Push Notification service for iOS devices
- FCM - Firebase Cloud Messaging for Android devices
Since push notifications are a unified message type, both services are configured in a single provider. If you only target one platform, leave the other section blank.
APNs (Apple Push Notifications)
Enable in Xcode
Add the Push Notification capability to your app in Xcode. Follow Apple's guide: Registering your app with APNs.
Enable in Apple Developer Portal
- Sign in to the Apple Developer Portal
- Navigate to Certificates, IDs & Profiles > Identifiers
- Select your app identifier
- Under Capabilities, enable Push Notifications
- Save your changes
Create Authentication Key
Lunogram uses token-based authentication with a .p8 key file. This is Apple's recommended approach:
- Works for both production and development
- Does not expire
- Single key for all your apps
- Follow Apple's guide: Establishing a Token-Based Connection to APNs
- Download the .p8 key file
Configure in Lunogram
- Go to Project Settings > Integrations > Add Integration
- Select APNs & FCM
- Fill in the APNs fields:
| Field | Description | Where to Find |
|---|---|---|
| Key | Contents of your .p8 file | Open in text editor |
| Key ID | 10-character identifier | Apple Developer > Keys |
| Team ID | 10-character identifier | Apple Developer (top right) |
| Bundle ID | Your app identifier | Apple Developer > Identifiers or Xcode |
- Save the integration
FCM (Firebase Cloud Messaging)
Setup Firebase
Follow Google's guide to add Firebase to your Android app: Add Firebase to your Android project.
Create Service Account
- Open Firebase Console
- Click the gear icon > Project Settings
- Navigate to Cloud Messaging
- If Firebase Cloud Messaging API (V1) is disabled, click the menu and enable it
- Navigate to Service Accounts
- Click Generate new private key
- Save the downloaded JSON file
Configure in Lunogram
- Go to Project Settings > Integrations > Add Integration
- Select APNs & FCM
- Open the downloaded JSON file in a text editor
- Copy the entire contents into the Service Account JSON field
- Save the integration
Client SDK Integration
iOS
Use the Lunogram iOS SDK to register device tokens:
func application(
_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data
) {
Lunogram.shared.register(token: deviceToken)
}Android
Use the Lunogram Android SDK to register FCM tokens:
class MyFirebaseMessagingService : FirebaseMessagingService() {
override fun onNewToken(token: String) {
Lunogram.shared.register(
token = token,
appBuild = BuildConfig.VERSION_CODE,
appVersion = BuildConfig.VERSION_NAME
)
}
}Testing
iOS Simulator
The iOS Simulator supports push notifications for testing. You can drag and drop an .apns file onto the simulator to trigger a notification.
Android Emulator
Use the Firebase Console's Cloud Messaging > Send test message feature to test on emulators with Google Play Services.
Troubleshooting
iOS: Notifications not received
- Verify your .p8 key is valid and not revoked
- Check the Bundle ID matches your app
- Ensure the device token is being registered
- Test with a real device (some features don't work on simulator)
Android: Notifications not received
- Verify your service account JSON is complete
- Check that FCM is enabled in Firebase Console
- Ensure google-services.json is in your app
- Test with a real device or emulator with Google Play Services