Fingerprint authentication in android and ios

I am trying to search the forum on how to implement​ fingerprint authentication in fuse. Is there any js api that i can use?

Hi qusyairi,

I’m afraid there are no JS wrappers created for fingerprint auth libraries at this point, at least I couldn’t find any. You are welcome to start a community effort of creating one.

Hi all, I am interested in this topic and trying to develop it using foreign code. Are there any improvements within this five months? If you have any references or improvements, please inform here. Because these days I am working on it.

@inod: no, we have not seen any attempts at implementing this yet. Let us know how it goes!

I’d take a look at this blog post that Remi from the Fuse team wrote when he implemented another iOS specific feature (voice recognition) with Foreign Code: https://blog.fusetools.com/fuse-foreign-speech-c4d888b505ec

There is a cordova Fuse bridge which let you use cordova plugins. Maybe that fits in your case:

Hi all, I think Cordova bridge only support for ios platform. As well as fingerprint authentication already has built for ios. https://github.com/bolav/fuse-touchid/blob/master/iOSFingerPrint.uno

In here, I am trying to do it with android platform. But I can’t give android permission. My error is,

Uno.Permissions.Permissions.Android does not contain a member called 'USE_FINGERPRINT'. Could you be missing a package reference?

The problem is fingerprint permission haven’t included fuse documentation under “What permissions are requestable by default?”

Did you take a look at the Android Permissions documentation? https://www.fusetools.com/docs/native-interop/android-permissions

Or this related thread from the Forum? https://www.fusetools.com/community/forums/howto_discussions/removing_unnecessary_android_permissions

When I tried with READ_CALL_LOG, It works properly.

Now I want to give the permission with USE_FINGERPRINT.

Again I tried it manually, edited Manifest file and then run build.bat, installed apk, But It didn’t ask for permission on my device. I checked both ways.
This is my template,

using Uno.Threading;
using Uno;
using Uno.UX;
using Uno.Compiler.ExportTargetInterop;
using Android;
using Uno.Permissions;


using Fuse;
using Fuse.Scripting;

[extern(Android) ForeignInclude(Language.Java,     
                        "android.content.Intent", 
                        "android.content.Context", 
                        "android.os.Bundle",
                        "android.content.SharedPreferences",
                        "android.os.Handler",
                        "android.hardware.fingerprint.FingerprintManager",
                        "java.lang.Object"
                         )]

[UXGlobalModule]
public class fingerAndroid : NativeModule{
    static readonly fingerAndroid _instance;
    static string getPermission;
    
    public fingerAndroid(){
        if (_instance != null) return;
    	_instance = this;
    	Resource.SetGlobalKey(_instance, "fingerAndroid");
        AddMember(new NativeFunction("fingerPrintAuth",(NativeCallback)fingerPrint));
    }

    object fingerPrint(Context c, object[] args){
        var permissionPromise = Permissions.Request(Permissions.Android.USE_FINGERPRINT);
        permissionPromise.Then(OnPermitted, OnRejected);
        return getPermission;
        //fingerPrintImpl();
        //return null;
    }

    void OnPermitted(PlatformPermission permission)
     {
          debug_log "Access to the fingerprint Scanner!";
          getPermission = fingerPrintImpl();
     }

     void OnRejected(Exception e)
     {
         debug_log "Blast: " + e.Message;
     }

    [Foreign(Language.Java)]
    public static extern(Android) string fingerPrintImpl()
    @{
    android.util.Log.d("Inside the fingerPrintImpl", "Started!");
    return null;
    //My Code will goes here
    @}

    static extern(!Android) string fingerPrintImpl(){
        debug_log("Notifications not supported on this platform.");
        return null;
    }

}

@inod: when looking at Android docs, it seems that you should NOT be requesting this permission during run-time (which Uno.Permissions is used for), but instead simply add it to your manifest as an install-time permission. The forum thread that Bent linked shows you how.