What I'm missing on this Uno Plugin?

I’ve made a plugin to check if your phone has another app installed, like waze or whatever.

It work’s well on iOS, but when I try to compile for Android I’m getting this error:

There is nothing named 'checkUrl' accessible in this scope. Are you missing a package reference?

This is the code:

using Fuse;
using Fuse.Scripting;
using Fuse.Reactive;
using Uno.UX;
using Uno.Compiler.ExportTargetInterop;

[UXGlobalModule]
public class UrlModule : NativeModule
{
    static readonly UrlModule _instance;

    public UrlModule()
    {
        // Make sure we're only initializing the module once
        if(_instance != null) return;

        _instance = this;
        Resource.SetGlobalKey(_instance, "UrlModule");
        AddMember(new NativeFunction("canOpenUrl", (NativeCallback)canOpenUrl));
    }

    [Foreign(Language.Java)]
    public static extern(Java) bool checkUrl(string url, string package)
    @{
        PackageManager pm = getPackageManager();
        try {
            pm.getPackageInfo(package, PackageManager.GET_ACTIVITIES);
            return pm.getApplicationInfo(package, 0).enabled;
        }
        catch (PackageManager.NameNotFoundException e) {
            return false;
        }
    @}

    [Foreign(Language.ObjC)]
	public static extern(iOS) bool checkUrl(string url, string package)
	@{
        NSString* appURL = [NSString stringWithFormat:@"%@", url];
        BOOL canOpenURL = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:appURL]];
        return canOpenURL;
	@}

    public static extern(!(iOS || Android)) bool checkUrl(string url, string package) {
        return false;
    }

    static object canOpenUrl(Context c, object[] args)
    {
        var url = args[0] as string;
        var package = args[1] as string;
        return checkUrl(url, package);
    }

}

Hey Raphael! The problem is probably the extern(Java) which should be extern(Android). Other than that it looks like it should work. Good luck! :slight_smile: