Learn how to send push notifications to users when they are offline.
HTTP v1 API
How to enable Cloud Messaging API (Legacy)
build.gradle
file.build.gradle
file.build.gradle
file.google-services.json
file from your Firebase Project dashboard and put it into your app folder in your Android project.com.quickblox.messages.TYPE
- can be GCM
or FCM
.com.quickblox.messages.SENDER_ID
- your sender ID from google console (for example, 639872757929).com.quickblox.messages.QB_ENVIRONMENT
- can be DEVELOPMENT
or PRODUCTION
.QBFcmPushListenerService
and QBFcmPushInstanceIDService
in AndroidManifest.QBSubscribeListener
. Just add QBSubscribeListener
right after the QBSettings.getInstance().init()
code.
SubscribePushStrategy.NEVER
as the main strategy.QBFcmPushListenerService
you need to handle when the token is refreshed:QBFcmPushListenerService
to the Manifest file.token
is a device registration token generated by the APNs or GCM/FCM. The token can be unregistered by the APNs or GCM/FCM anytime. In this case, the device should be registered again and obtain a new token. When a new token is obtained, a new subscription should be created.QBEvent
, fill its fields with push notification parameters (payload) and set push recipients.
BroadcastReceiver
.
onMessageReceived()
in your class that extends QBFcmPushListenerService
.
error 401 (Unauthorized, check your App auth_key)
. This means that the QuickBlox server wasn’t able to authorize on the Firebase server.
Cause 2: incorrect FCM sender ID in the google-services.json
file.
google-services.json
file to your project.token
within the system. See this section to learn how to subscribe a device to push notifications.