Skip to content

Show large notification #59

Open
Open

Description

@sagarmp02

If this issue is for a new feature, please skip the "Bug" section and fill out the "Feature Request" section at the bottom.

Bug

Plugin Version:
Platform (e.g., Android v21):
Device/Hardware:

Expected behavior

Actual behavior

Steps to reproduce the behavior

Feature Request

Feature description:
I am using the following code in xamarin.forms page to send notification
CrossLocalNotifications.Current.Show("title", "body");
it is working fine. But in the body, if I have long text how to show?.
In a few places, I found that use the following code in the main activity of the Android project
String longText = "...";
Notification noti = new Notification.Builder(this).
.setStyle(new Notification.BigTextStyle().bigText(longText))
but NotificationBuilder class doesn't supports in xamarin.forms project.
How should I set this from xamarin.forms project?. Please help me out

Activity

  1. DoktorAerzt commented on Mar 6, 2019

    @DoktorAerzt

    This whould be a Feature Request, were you want that the plugin is changing the Notification Style when your text is to long.
    This needs to be done directly in the plugin and no in your Xamarin.Forms project.

  2. sagarmp02 commented on Mar 6, 2019

    @sagarmp02
    Author

    Thank u for your reply @DoktorAerzt . Authors, please look into this request

  3. DoktorAerzt commented on Mar 6, 2019

    @DoktorAerzt

    The point is, how long needs the long text to be that the normal notification is to small and that you need BigTextStyle() ?

  4. sagarmp02 commented on Mar 6, 2019

    @sagarmp02
    Author

    @DoktorAerzt , maybe 4 or 5 lines I need to show in the notification. can i achieve my requirement by using BigTextStyle(). If yes how and where I need to set? my requirement like
    image

  5. DoktorAerzt commented on Mar 6, 2019

    @DoktorAerzt

    I never worked with BigTextStyle() so i don´t know if this will help you or if this is what you need. But you need to add a check at this line https://github.com/edsnider/localnotificationsplugin/blob/master/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs#L33 and then if the body is greater/longer than let´s say 30 Chars then you need to use the BigTextStyle()

    I don´t have the time to test this out and to make this changes.

    After you make this changes you need to make an pull request.

  6. sagarmp02 commented on Mar 6, 2019

    @sagarmp02
    Author

    Hi @DoktorAerzt , following code will work. I am not understanding how to do pull request. can u add the following code at line number 33
    please do help
    if(body.Length > 30)
    {
    builder.SetStyle(new NotificationCompat.BigTextStyle().BigText(body));
    }

  7. sagarmp02 commented on Mar 8, 2019

    @sagarmp02
    Author

    HI @edsnider please look into this just one line of code we need to change here
    builder.SetStyle(new Notification.BigTextStyle().BigText(body));
    and update package from 23 to 28
    please do consider this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions