How to detect whether push notification is enabled in Android?

MingLiMingLi USUniversity ✭✭

I have found a post on Stack Overflow: Going through the responses on that post, I found that Android.Support.V4.App library has a method called "areNotificationEnabled()" [], which should return whether notification is enabled. However, this method is not included in the "Xamarin.Android.Support.V4". So, how do I detect whether push notification is enabled in Android with Xamarin?



  • rene_ruppertrene_ruppert DEXamarin Team, University, XamUProfessors Xamurai

    I just gave it a try and the method is available in version 24.2.1 of the Xamarin.Android.Support.v4 package:

    var nm =  NotificationManagerCompat.From (this);
    bool enabled = nm.AreNotificationsEnabled ();
  • MingLiMingLi USUniversity ✭✭

    Thank you Rene for your response. I just tried to update my nuget package to 24.2.1 from, but the package cannot be installed. The message that I received was "Could not install package 'Xamarin.Android.Support.Cmpat 24.2.1'. You are trying to install this package into a project that targets 'MonoAndroid, Version=v6.0', but the package does not contain any assembly references or content files that are compatible with that framework..." Any ideas?

    Thanks again.

  • MingLiMingLi USUniversity ✭✭

    It looks like after I updated the TargetFrameworkVersion from v6.0 to v7.0, the nuget packages were successfully updated. Thank you very much!

Sign In or Register to comment.