Xamarin Forms Android Fixed Notification

ByBerkByBerk Member ✭✭

Hi all,

I want fixed notification xamarin forms on android. I mean like music app or love counter app notifications unremovable and updateable.

Also the notification package should be able to do them. Even if Android restarts, it should not be affected. The application should notify even if it is closed.

Is this possible?

Thanks in advance

Best Answer

Answers

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    Are there any updates for this issue? If the reply is helpful, please try to mark it as an answer, it will help others who have similar issue.

  • ByBerkByBerk Member ✭✭
    edited June 20

    @LeonLu said:
    Are there any updates for this issue? If the reply is helpful, please try to mark it as an answer, it will help others who have similar issue.

    Hi LeonLu,

    Thanks for replies and sharing. I examined code and trying sample. yes fixed notification worked as service. How do I update it on the PCL (sharing code) side instantly? Do you have sample code for this?

    Note: I'm removed channell id code and worked on android 5.0.
    var notification = new Notification.Builder(this, "10111") remove 10111

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    If you just use it in android 5.0, you can remove channel id, but if you want to use notification in android 8.0 or later, you should create an notification channel and unique channel id.

    How do I update it on the PCL (sharing code) side instantly? Do you have sample code for this?

    You can use MessageCenter send information between PCL and android .You can refer to this link.
    https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/messaging-center

  • ByBerkByBerk Member ✭✭
    edited June 21

    Hi LeonLu,

    Thanks for messaging center suggestion. It seems to be working right now. I keep testing. My last question is how do I catch the click on the notification. For example, to the homepage.

  • ByBerkByBerk Member ✭✭

    Hi @LeonLu

    Everything is working ok with your help. I noticed something.
    I resend new value every second. This works. But after a while it slows down. For example, after 1 hour, it is progressing to 2 seconds. Very slow in app. Is Android auto slowing down my app?
    Extend the timer time for solution? Or How can we fix this?

    Thanks

  • ByBerkByBerk Member ✭✭

    Hi @LeonLu

    I increased timer tick value to 10 minutes. But device reboot killing foreground notification. How can startforeground notification on boot completed ?

    Thanks

Sign In or Register to comment.