Local Notifications Plugin - Image/Logo

ervaerva USMember ✭✭
edited April 2017 in Xamarin.Forms

Hello guys!
I'm using Local Notifications Plugin for Xamarin.
(https://github.com/edsnider/LocalNotificationsPlugin)
I got it working, but I have a question about the logo beside the notification.

I doesn't understand the readme in https://github.com/edsnider/LocalNotificationsPlugin

Does anyone know how to change it?
(Both on Android and iOS) .

Thanks!

Posts

  • RaphaelSchindlerRaphaelSchindler USMember ✭✭✭
    edited April 2017

    You should take a look at this plugin. I'm using this in a few apps. It uses your App Icon for the notifications

  • gimkimgimkim THMember ✭✭

    @RaphaelSchindler said:
    You should take a look at this plugin. I'm using this in a few apps. It uses your App Icon for the notifications

    How do you handle the action when the notification was tapped ?
    On android, it launched a new activity replacing the current one.
    How to make it bring the current activity up without replacing the current one?
    Thanks.

  • RaphaelSchindlerRaphaelSchindler USMember ✭✭✭

    @gimkim Take a look on the Application Lifecycles. You should be able to resume to the current activity in OnResume. Maybe a few more infos would be great.

  • gimkimgimkim THMember ✭✭
    edited December 2017

    @RaphaelSchindler said:
    @gimkim Take a look on the Application Lifecycles. You should be able to resume to the current activity in OnResume. Maybe a few more infos would be great.

    OnResume is called when the app was in sleep state and I switched back to it. I've used this method to managing state and do the messaging of the background services in my app.

    But in this case when I tapped at the notification created from the plugin you mentioned,
    It called the OnCreate() in MainActivity.cs which called App() and OnStart() again. Which create another android activity re-launching the app on top on currently active app. Not resuming an existing one.

    I've searched for days and found that I have to set LaunchMode = LaunchMode.SingleTop and override OnNewIntent() to make the app reuse existing activity without creating a new one. But when I tapped at the notification It still call OnCreate() not OnNewIntent() as I wanted.

  • RaphaelSchindlerRaphaelSchindler USMember ✭✭✭
    edited December 2017

    @gimkim Yeah, I think I found the problem, but don't pin me on it, I didn't created the plugin :)

    launchIntent.SetFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask); this line is from the source code. Maybe get in touch with aritchie on his github. I bet he can clarify that better.

    //Edit: I just saw that you already opened an issue. Sorry. Maybe try to fork it and set some other ActivityFlags.

  • gimkimgimkim THMember ✭✭
    edited December 2017

    Editing launch intent in the code and build the dll by myself worked. Thanks @RaphaelSchindler :)

  • EhsanJahanagiriEhsanJahanagiri USMember ✭✭

    check the link again
    https://github.com/edsnider/LocalNotificationsPlugin

    LocalNotificationsImplementation.NotificationIconId = Resource.Drawable.YOU_ICON_HERE
    
Sign In or Register to comment.