facebookarchive / FBNotifications

Facebook Analytics In-App Notifications Framework
https://developers.facebook.com/products/push-campaigns
Other
493 stars 74 forks source link

NotificationsManager.presentCard does not send any event. #41

Open SupreeNuri opened 7 years ago

SupreeNuri commented 7 years ago

I dug into the code and found that the "NotificationsManager.presentCard" will automatically log events such as dismiss, push opens, button click, etc.

The app successfully shows the Facebook CardActivity but I did not receive any events after dismissing the CardView.

Here is my onMessageReceived

@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
    Bundle dataBundle = new Bundle();
            for (Map.Entry<String, String> entry : remoteMessage.getData().entrySet()) {
                dataBundle.putString(entry.getKey(), entry.getValue());
            }
}

My notification

Intent intent = new Intent(getApplicationContext(), MainActivity.class);
intent.putExtra("Card_Bundle",dataBundle);
PendingIntent pendingIntent = PendingIntent.getActivity(this, identifier, intent, PendingIntent.FLAG_UPDATE_CURRENT);

                //Facebook In-App Notification
                final Notification.Builder mBuilder = new Notification.Builder(this)
                        .setSmallIcon(R.drawable.notification_ic_small)
                        .setContentTitle(title == null ? "" : title)
                        .setContentText(description == null ? "" : description)
                        .setAutoCancel(true)
                        .setContentIntent(pendingIntent);

                NotificationsManager.presentNotification(
                        this,
                        dataBundle,
                        new Intent(getApplicationContext(), MainActivity.class),
                        new NotificationsManager.NotificationExtender() {
                            @Override
                            public Notification.Builder extendNotification(@NonNull Notification.Builder notification) {
                                return mBuilder;
                            }
                        }
                );

My MainActivity

NotificationsManager.presentCard(MainActivity.this, getIntent().getBundleExtra("Card_Bundle"));

Results screenshot_20171005-003305 1

screen shot 2560-10-05 at 00 34 47
KathySwe commented 6 years ago

How could u push notification from facebook analytic? I appreciate if u could tell me plz