Trying to make Plugin work

Hello guys.
Currently I’m trying to make a feature that check the Notification permission status (Allow, not allow,…) by making a native plugin on android.

    private static final String LOGTAG = "UnityU";

    private Context context;

    public NotificationStatusChecker(Context context) {

        this.context = context;
    }

    public boolean areNotificationsEnabled() {
        boolean result = NotificationManagerCompat.from(this.context).areNotificationsEnabled();
        Log.i(LOGTAG, "Notifications enabled :: " + result);
        return result;
    }

    public static boolean areNotificationsEnabledFromContext(Context customContext) {
        boolean result = NotificationManagerCompat.from(customContext).areNotificationsEnabled();
        Log.i(LOGTAG, "From custom context notifications enabled :: " + result);
        return result;
    }

Those above are my code from this thread
But I keep getting this error from blank project, what can I do?

2021-09-22 15:11:41.550 24069-8421/? E/Unity: AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/core/app/NotificationManagerCompat;
    java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/core/app/NotificationManagerCompat;
        at ftech.plugin.unity.NotificationStatusChecker.areNotificationsEnabled(NotificationStatusChecker.java:20)
        at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
        at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
        at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source:72)
        at android.os.MessageQueue.next(MessageQueue.java:404)
        at android.os.Looper.loop(Looper.java:206)
        at com.unity3d.player.UnityPlayer$e.run(Unknown Source:32)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.core.app.NotificationManagerCompat" on path: DexPathList[[zip file "/data/app/~~Io9vCKuyx0nvVM_OJ04_rg==/ftech.vn.unity-Y5GsG9bnUHDMrgubc8vB6Q==/base.apk"],nativeLibraryDirectories=[/data/app/~~Io9vCKuyx0nvVM_OJ04_rg==/ftech.vn.unity-Y5GsG9bnUHDMrgubc8vB6Q==/lib/arm, /data/

Make sure you add androidx.core:core as dependency.

How do I do that may I ask?
Include the androidx.core:core in the build.gradle file for the module or include it inside the maingradle.template in Unity?
Can the android resolver package automate this step?

There are couple of ways to do that

  1. Download that module and include in your project - BIG NO
  2. Add the dependency in your custom gradle file - Ok
  3. Import External Dependency Manager package and add the below dependency - Recommended

After importing the above package (from #3), include the below contents in a xml file (lets say AndroidDependencies.xml) and place it under Editor folder

<dependencies>
  <packages>
    <package>androidx.core:core:1.3+</package>
  </packages>
</dependencies>

Thanks,
VB Team

This xml content works for me with the External Dependency Manager package.

<?xml version="1.0" encoding="UTF-8" ?>
<dependencies>
    <androidPackages>
        <androidPackage spec="androidx.appcompat:appcompat:1.1.0">
        </androidPackage>
    </androidPackages>
</dependencies>