Toast Notifications not working on XF Android 8.0/1












0














I have a cross platform XF app.



I am using Toast.Forms for sending local app notifications, the plugin works on both iOS and Android.
On iOS it works perfectly fine, but on Android it works only for versions lower than 7.1, for oreo 8.0 or 8.1 (> API 26) it does not work anymore.



Here is my toast class:



internal class ToastService : IToastService
{
private readonly IAppDeviceDependency _DeviceDependency;

public ToastService([NotNull] IAppDeviceDependency deviceDependency)
{
_DeviceDependency = deviceDependency ?? throw new ArgumentNullException(nameof(deviceDependency));
}

public void ShowToast(string title, string description, bool isClickable, bool clearFromHistory)
{
DeviceToastProvider.ShowToast(title, description, isClickable, clearFromHistory);
}

private IToastProvider DeviceToastProvider => _DeviceDependency.Get<IToastProvider>();
}


Android toast provider:



[assembly: Dependency(typeof(AndroidToastProvider))]

namespace MyApp.Droid.Providers
{
public class AndroidToastProvider : IToastProvider
{
public async void ShowToast(string title, string description, bool isClickable, bool clearFromHistory)
{
var notificator = DependencyService.Get<IToastNotificator>();
await notificator.Notify(new NotificationOptions
{
Title = title,
Description = description,
IsClickable = isClickable,
ClearFromHistory = clearFromHistory
});
}
}
}


Apple toast provider



[assembly: Dependency(typeof(AppleToastProvider))]
namespace MyApp.iOS.Providers
{
public class AppleToastProvider : IToastProvider
{
public async void ShowToast(string title, string description, bool isClickable, bool clearFromHistory)
{
var notificator = DependencyService.Get<IToastNotificator>();
await notificator.Notify(new NotificationOptions
{
Title = title,
Description = description,
IsClickable = isClickable,
ClearFromHistory = clearFromHistory
});
}
}
}









share|improve this question





























    0














    I have a cross platform XF app.



    I am using Toast.Forms for sending local app notifications, the plugin works on both iOS and Android.
    On iOS it works perfectly fine, but on Android it works only for versions lower than 7.1, for oreo 8.0 or 8.1 (> API 26) it does not work anymore.



    Here is my toast class:



    internal class ToastService : IToastService
    {
    private readonly IAppDeviceDependency _DeviceDependency;

    public ToastService([NotNull] IAppDeviceDependency deviceDependency)
    {
    _DeviceDependency = deviceDependency ?? throw new ArgumentNullException(nameof(deviceDependency));
    }

    public void ShowToast(string title, string description, bool isClickable, bool clearFromHistory)
    {
    DeviceToastProvider.ShowToast(title, description, isClickable, clearFromHistory);
    }

    private IToastProvider DeviceToastProvider => _DeviceDependency.Get<IToastProvider>();
    }


    Android toast provider:



    [assembly: Dependency(typeof(AndroidToastProvider))]

    namespace MyApp.Droid.Providers
    {
    public class AndroidToastProvider : IToastProvider
    {
    public async void ShowToast(string title, string description, bool isClickable, bool clearFromHistory)
    {
    var notificator = DependencyService.Get<IToastNotificator>();
    await notificator.Notify(new NotificationOptions
    {
    Title = title,
    Description = description,
    IsClickable = isClickable,
    ClearFromHistory = clearFromHistory
    });
    }
    }
    }


    Apple toast provider



    [assembly: Dependency(typeof(AppleToastProvider))]
    namespace MyApp.iOS.Providers
    {
    public class AppleToastProvider : IToastProvider
    {
    public async void ShowToast(string title, string description, bool isClickable, bool clearFromHistory)
    {
    var notificator = DependencyService.Get<IToastNotificator>();
    await notificator.Notify(new NotificationOptions
    {
    Title = title,
    Description = description,
    IsClickable = isClickable,
    ClearFromHistory = clearFromHistory
    });
    }
    }
    }









    share|improve this question



























      0












      0








      0







      I have a cross platform XF app.



      I am using Toast.Forms for sending local app notifications, the plugin works on both iOS and Android.
      On iOS it works perfectly fine, but on Android it works only for versions lower than 7.1, for oreo 8.0 or 8.1 (> API 26) it does not work anymore.



      Here is my toast class:



      internal class ToastService : IToastService
      {
      private readonly IAppDeviceDependency _DeviceDependency;

      public ToastService([NotNull] IAppDeviceDependency deviceDependency)
      {
      _DeviceDependency = deviceDependency ?? throw new ArgumentNullException(nameof(deviceDependency));
      }

      public void ShowToast(string title, string description, bool isClickable, bool clearFromHistory)
      {
      DeviceToastProvider.ShowToast(title, description, isClickable, clearFromHistory);
      }

      private IToastProvider DeviceToastProvider => _DeviceDependency.Get<IToastProvider>();
      }


      Android toast provider:



      [assembly: Dependency(typeof(AndroidToastProvider))]

      namespace MyApp.Droid.Providers
      {
      public class AndroidToastProvider : IToastProvider
      {
      public async void ShowToast(string title, string description, bool isClickable, bool clearFromHistory)
      {
      var notificator = DependencyService.Get<IToastNotificator>();
      await notificator.Notify(new NotificationOptions
      {
      Title = title,
      Description = description,
      IsClickable = isClickable,
      ClearFromHistory = clearFromHistory
      });
      }
      }
      }


      Apple toast provider



      [assembly: Dependency(typeof(AppleToastProvider))]
      namespace MyApp.iOS.Providers
      {
      public class AppleToastProvider : IToastProvider
      {
      public async void ShowToast(string title, string description, bool isClickable, bool clearFromHistory)
      {
      var notificator = DependencyService.Get<IToastNotificator>();
      await notificator.Notify(new NotificationOptions
      {
      Title = title,
      Description = description,
      IsClickable = isClickable,
      ClearFromHistory = clearFromHistory
      });
      }
      }
      }









      share|improve this question















      I have a cross platform XF app.



      I am using Toast.Forms for sending local app notifications, the plugin works on both iOS and Android.
      On iOS it works perfectly fine, but on Android it works only for versions lower than 7.1, for oreo 8.0 or 8.1 (> API 26) it does not work anymore.



      Here is my toast class:



      internal class ToastService : IToastService
      {
      private readonly IAppDeviceDependency _DeviceDependency;

      public ToastService([NotNull] IAppDeviceDependency deviceDependency)
      {
      _DeviceDependency = deviceDependency ?? throw new ArgumentNullException(nameof(deviceDependency));
      }

      public void ShowToast(string title, string description, bool isClickable, bool clearFromHistory)
      {
      DeviceToastProvider.ShowToast(title, description, isClickable, clearFromHistory);
      }

      private IToastProvider DeviceToastProvider => _DeviceDependency.Get<IToastProvider>();
      }


      Android toast provider:



      [assembly: Dependency(typeof(AndroidToastProvider))]

      namespace MyApp.Droid.Providers
      {
      public class AndroidToastProvider : IToastProvider
      {
      public async void ShowToast(string title, string description, bool isClickable, bool clearFromHistory)
      {
      var notificator = DependencyService.Get<IToastNotificator>();
      await notificator.Notify(new NotificationOptions
      {
      Title = title,
      Description = description,
      IsClickable = isClickable,
      ClearFromHistory = clearFromHistory
      });
      }
      }
      }


      Apple toast provider



      [assembly: Dependency(typeof(AppleToastProvider))]
      namespace MyApp.iOS.Providers
      {
      public class AppleToastProvider : IToastProvider
      {
      public async void ShowToast(string title, string description, bool isClickable, bool clearFromHistory)
      {
      var notificator = DependencyService.Get<IToastNotificator>();
      await notificator.Notify(new NotificationOptions
      {
      Title = title,
      Description = description,
      IsClickable = isClickable,
      ClearFromHistory = clearFromHistory
      });
      }
      }
      }






      c# xamarin.forms notifications xamarin.android toast






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 '18 at 9:11







      Iliut Andrei

















      asked Nov 12 '18 at 9:04









      Iliut AndreiIliut Andrei

      286




      286
























          2 Answers
          2






          active

          oldest

          votes


















          1














          Android 8 requires notifications to have a channel assigned to them to be displayed (see more here: https://developer.android.com/guide/topics/ui/notifiers/notifications). If your plugin doesn't support that you can ask the authors to update it in a proper way or you can create your own code using native APIs.






          share|improve this answer





















          • I don't think that Toast plugin was updated to support Android 8.0 unfortunately, therefore I must right a special case for Android 8.0 notifications, as you have mentioned. I will create a Notification Channel most likely. Thank you!
            – Iliut Andrei
            Nov 13 '18 at 8:35



















          0














          Found the solution to the problem. Apparently I was compiling using Android version 7.1, which does not support the newly Notification Channel of the Android Oreo 8.0. Now I am compiling using Android 8.1 (Oreo), I have updated Toast.plugin to the latest version and it works perfectly fine on all versions lowers than Android 8.1



          More on the issue can be found here: https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/notifications/local-notifications






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53258824%2ftoast-notifications-not-working-on-xf-android-8-0-1%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            Android 8 requires notifications to have a channel assigned to them to be displayed (see more here: https://developer.android.com/guide/topics/ui/notifiers/notifications). If your plugin doesn't support that you can ask the authors to update it in a proper way or you can create your own code using native APIs.






            share|improve this answer





















            • I don't think that Toast plugin was updated to support Android 8.0 unfortunately, therefore I must right a special case for Android 8.0 notifications, as you have mentioned. I will create a Notification Channel most likely. Thank you!
              – Iliut Andrei
              Nov 13 '18 at 8:35
















            1














            Android 8 requires notifications to have a channel assigned to them to be displayed (see more here: https://developer.android.com/guide/topics/ui/notifiers/notifications). If your plugin doesn't support that you can ask the authors to update it in a proper way or you can create your own code using native APIs.






            share|improve this answer





















            • I don't think that Toast plugin was updated to support Android 8.0 unfortunately, therefore I must right a special case for Android 8.0 notifications, as you have mentioned. I will create a Notification Channel most likely. Thank you!
              – Iliut Andrei
              Nov 13 '18 at 8:35














            1












            1








            1






            Android 8 requires notifications to have a channel assigned to them to be displayed (see more here: https://developer.android.com/guide/topics/ui/notifiers/notifications). If your plugin doesn't support that you can ask the authors to update it in a proper way or you can create your own code using native APIs.






            share|improve this answer












            Android 8 requires notifications to have a channel assigned to them to be displayed (see more here: https://developer.android.com/guide/topics/ui/notifiers/notifications). If your plugin doesn't support that you can ask the authors to update it in a proper way or you can create your own code using native APIs.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 12 '18 at 9:27









            Ivan IčinIvan Ičin

            3,66642343




            3,66642343












            • I don't think that Toast plugin was updated to support Android 8.0 unfortunately, therefore I must right a special case for Android 8.0 notifications, as you have mentioned. I will create a Notification Channel most likely. Thank you!
              – Iliut Andrei
              Nov 13 '18 at 8:35


















            • I don't think that Toast plugin was updated to support Android 8.0 unfortunately, therefore I must right a special case for Android 8.0 notifications, as you have mentioned. I will create a Notification Channel most likely. Thank you!
              – Iliut Andrei
              Nov 13 '18 at 8:35
















            I don't think that Toast plugin was updated to support Android 8.0 unfortunately, therefore I must right a special case for Android 8.0 notifications, as you have mentioned. I will create a Notification Channel most likely. Thank you!
            – Iliut Andrei
            Nov 13 '18 at 8:35




            I don't think that Toast plugin was updated to support Android 8.0 unfortunately, therefore I must right a special case for Android 8.0 notifications, as you have mentioned. I will create a Notification Channel most likely. Thank you!
            – Iliut Andrei
            Nov 13 '18 at 8:35













            0














            Found the solution to the problem. Apparently I was compiling using Android version 7.1, which does not support the newly Notification Channel of the Android Oreo 8.0. Now I am compiling using Android 8.1 (Oreo), I have updated Toast.plugin to the latest version and it works perfectly fine on all versions lowers than Android 8.1



            More on the issue can be found here: https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/notifications/local-notifications






            share|improve this answer


























              0














              Found the solution to the problem. Apparently I was compiling using Android version 7.1, which does not support the newly Notification Channel of the Android Oreo 8.0. Now I am compiling using Android 8.1 (Oreo), I have updated Toast.plugin to the latest version and it works perfectly fine on all versions lowers than Android 8.1



              More on the issue can be found here: https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/notifications/local-notifications






              share|improve this answer
























                0












                0








                0






                Found the solution to the problem. Apparently I was compiling using Android version 7.1, which does not support the newly Notification Channel of the Android Oreo 8.0. Now I am compiling using Android 8.1 (Oreo), I have updated Toast.plugin to the latest version and it works perfectly fine on all versions lowers than Android 8.1



                More on the issue can be found here: https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/notifications/local-notifications






                share|improve this answer












                Found the solution to the problem. Apparently I was compiling using Android version 7.1, which does not support the newly Notification Channel of the Android Oreo 8.0. Now I am compiling using Android 8.1 (Oreo), I have updated Toast.plugin to the latest version and it works perfectly fine on all versions lowers than Android 8.1



                More on the issue can be found here: https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/notifications/local-notifications







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 13 '18 at 13:38









                Iliut AndreiIliut Andrei

                286




                286






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53258824%2ftoast-notifications-not-working-on-xf-android-8-0-1%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown