I'm trying to implement FB Analytics Push Campaigns on Android.
Eveything went fine with the push notifications, so I've turned my attention to the in-app notifications.
The docs' example calls for the use of a class called NotificationsManager
:
public class MyGcmListenerService extends GcmListenerService {
@Override
public void onMessageReceived(String from, Bundle data) {
if (NotificationsManager.canPresentCard(data)) {
NotificationsManager.presentNotification(
this,
data,
new Intent(getApplicationContext(), MainActivity.class)
);
}
}
}
But I can't for the life of me find that class in the FB SDK, nor in the FB-Audience SDK.
I'm using v4.17.0 of the SDK. The changelog states in-app notifications were added on 4.11.0.
Wow. FB has the worst docs ever.
Apparently there is a small open source project that handles in-app notifications, and it's separated from the main SDK.
To get NotificationsManager, you need to add the following line to your gradle.build file:
compile 'com.facebook.android:notifications:1+';
Also, here is the GitHub repository for the notifications project. It contains some samples to help you with the integration.
EDIT: I've alerted FB to the issue and the support rep opened a ticket for them to update the doc.