Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

In-App notifications does not work with Android Oreo #47

Open
Veeresh8 opened this issue Jan 15, 2018 · 8 comments
Open

In-App notifications does not work with Android Oreo #47

Veeresh8 opened this issue Jan 15, 2018 · 8 comments

Comments

@Veeresh8
Copy link

Recently tested out the library where the push notifications work properly (Adding notification channels) with Android Oreo but in-app notifications do not work. Please give an option to provide notification channels for in-app notifications.

@soniccat
Copy link

soniccat commented Jan 19, 2018

That can be done this way:

NotificationsManager.presentNotification(context, extras, ..., new NotificationsManager.NotificationExtender() {
@Override
public Notification.Builder extendNotification(@NonNull Notification.Builder notification) {
 String channelId = getString(R.string.news_channel_id);
                if (Constants.SUPPORT_OREO) {
                    notification.setChannelId(channelId);
                }
                notification.setSmallIcon(getIconRes());
                return notification;
            }
        });

@Veeresh8
Copy link
Author

Is this for in-app notification or the push notification?

@soniccat
Copy link

soniccat commented Jan 19, 2018

hm, I see some code was cut, it's for in-app notifications, updated code above, it's used with NotificationsManager.presentNotification

@Veeresh8
Copy link
Author

Veeresh8 commented Jan 19, 2018

I can't seem to add the method there, I'm using the gradle dependency. Should I download and include as Library?

@soniccat
Copy link

soniccat commented Jan 19, 2018

@Veeresh8 we use the gradle dependency too 'com.facebook.android:notifications:1.0.2'. Can you see that with notificationExtender?:

  public static void presentNotification(
    @NonNull final Context context,
    @NonNull final Bundle notificationBundle,
    @NonNull final Intent launcherIntent,
    @Nullable final NotificationExtender notificationExtender) {

you need to pass a NotificationExtender object

@Veeresh8
Copy link
Author

Oh, Okay. Thanks!

@Veeresh8
Copy link
Author

What is the notification object here?

@soniccat
Copy link

it's an argument ... its Notification.Builder

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants