Notifications have been updated to use Firebase Messaging instead of Google Cloud Messaging, which simplifies the integration required for getting push notifications to work with the deltaDNA Platform. Read on to find out how to upgrade from a previous version of the deltaDNA Android SDK.
You can remove the following permission-related entries:
<permission
android:name="your.package.name.permission.C2D_MESSAGE"
android:protectionLevel="signature"/>
<uses-permission
android:name="your.package.name.permission.C2D_MESSAGE"/>
The following receivers can be removed:
com.google.android.gms.gcm.GcmReceiver
The com.deltadna.android.sdk.notifications.NotificationListenerService
entry should look like:
<service
android:name="com.deltadna.android.sdk.notifications.NotificationListenerService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
With the move to Firebase the Application ID will need to be specified in addition to the already existing Sender ID. If your application needs to be migrated to the Firebase Console then you can find instructions here on how to do it. Once you've found your Application ID you will need to add it as a meta-data
entry inside of the application
section of your manifest file.
<application ...>
...
<meta-data
android:name="ddna_application_id"
android:resource="@string/application_id"/>
<meta-data
android:name="ddna_sender_id"
android:resource="@string/sender_id"/>
</application>
If using Unity then the Sender ID should be configured through the Unity Editor menu item.
The following meta-data
entries should no longer be used:
- ddna_start_launch_intent (kept for legacy support, will be removed sometime in the future)
Instead of registering a BroadcastReceiver
with the LocalBroadcastManager
and checking for Intent
actions we have added the EventReceiver
class which can be extended and registered in your manifest in order to listen to push notification related events.
In order to change the look and/or behaviour of posted notifications the NotificationListenerService
should be extended as before, but instead the createFactory(Context)
method should be overridden to provide a NotificationFactory
implementation setting the required behaviour.