Push
Last updated
Last updated
DFINERY uses Firebase Cloud Messaging to receive push notifications, so your application needs to integrate with Firebase.
In the case of push notifications for advertising purposes, prior consent must be obtained from the user in accordance with . In order to register with DFINERY that the user has permitted push notifications, please perform the following series of tasks.
Notify users to allow push notifications
Register the value of the user's permission/rejection intention in the user profile.
and enter values for the items to which the user has consented. The code below is an example of allowing consent to receive informational and advertising messages for push channels.
, go to Additional Settings/Channel Additional Settings/Push/Android Settings Management, enter the sender ID, and upload the Firebase user authentication information private key file in JSON format.
Open a build.gradle
file inside your app's module directory.
Add Support Library dependency to dependencies.
To link a token issued by Firebase to DFINERY, please write as follows.
Register the ID of a notification channel created using the setDefaultNotificationChannelId()
method of DfineryConfig or using res/values/dfinery.xml
using.
To display push notifications, you need to set an icon. Please setNotificationIcon()
use the method of DfineryConfig or res/values/dfinery.xml
use to set the icon.
Since the notification itself is an icon that is displayed in the top status bar as well as the color of the image is ignored, we recommend an image with a transparent color (alpha channel) of 72x72px.
Push settings are complete.
1. Create a notification channel.
The first parameter id represents the ID of the notification channel.
The second parameter, name, is the name of the notification channel. This value Settings/Notifications
is exposed to the user in.
2. Set a description for the notification channel. (Optional)
The value Settings/Notifications
is exposed to the user in.
3. Set whether the notification channel vibrates or not. (Optional)
The value of the notification channel always takes precedence over all settings set in the DFINERY console except 'Expose push messages while the app is running'.
4. Set the notification sound for the notification channel. (Optional)
Here's an example of setting the system default notification sound to play.
5. Register the created notification channel in NotificationManager.
6. Done.
2. Select the project for which you want to issue a key.
3. Click ⋮ in the Actions section at the bottom right.
4. Click Key Management from the drop-down.
5. Select Add Key.
If there is a key already created, it means that there is a history of creating a key in the past and you can use that key. If you cannot find the key, please create a new key.
6. Click Create New Key from the dropdown.
7. Select JSON and click Create.
8. Key issuance is complete.
Select a project.
In the left panel, click the ⚙️ icon to the right of the project overview.
Click Project Settings.
In the Project Settings top tab, click Cloud Messaging.
DFINERY requires to create push notifications, so complete the following series of steps:
by following the instructions in Add Firebase to your Android project provided by Firebase.
provided by Firebase, and apply the following:
Since tokens do not change frequently, we recommend writing them in the method of an object that inherits Application so that the code is not called frequently.
Override method in a class that inherits FirebaseMessagingService to register the token in DFINERY.
Starting with Android 8.0, you need to create a notification channel to receive notifications. Please refer to the instructions in provided by Android and .
When a push is received, a push notification is received by an object that inherits FirebaseMessagingService. DFINERY creates a notification based on the received push payload, so please write the following in the method of the object.
When you click on a push with deep link information, set in the deep link will be executed. If the deep link has no information, android.intent.action.MAIN
the Activity with the action will be executed.
For information on how to associate a deep link with an Activity, see
Here is an example of creating a notification channel. There is also , so please refer to it.
The notification channel API is supported on and higher.
The third parameter importance indicates of push notifications that will be received through this notification channel.
1. Log in to
If there is no project, it means that the Firebase project has not been created. Refer to to create a Firebase project.
Go to
Check