smstuebe / xamarin-fingerprint

Xamarin and MvvMCross plugin for authenticate a user via fingerprint sensor
Microsoft Public License
494 stars 118 forks source link

Report why IsAvailable = false (Android) #20

Closed ronpf closed 7 years ago

ronpf commented 8 years ago

The plugin is working fine on my Android 6.0 emulators but when running on my 6.0 real device the IsAvailable flag is false. The sample app also reports false on my phone and true on the emulators. Fingerprint authentication is set up and is used on the lock screen of the real device. Is there a way to diagnose and report why?

smstuebe commented 8 years ago

Is it a Samsung Device?

ronpf commented 8 years ago

Yep...Galaxy S5

smstuebe commented 8 years ago

Ok The reason is, Samsung has it's own fingerprint API called samsung pass. There is also an early issue (#2) to support it with the plugin. And I've already started the implementation.

ronpf commented 8 years ago

Well...that sucks that it only works with it's own api... Thank you for the info and the great work otherwise.

smstuebe commented 8 years ago

Hey @ronpf.

I just released 1.3.0-beta3 that contains support for Samsung devices. Can you please try again with this version?

ronpf commented 8 years ago

Looks like CrossFingerprint.Current.IsAvailable is still false.

Seeing this also Target _CompileToDalvikWithDx: Tool /..... warning: Ignoring InnerClasses attribute for an anonymous inner class (com.samsung.android.sdk.pass.a) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is not an inner class. Same message for com.samsung.android.sdk.pass.b com.samsung.android.sdk.pass.c com.samsung.android.sdk.pass.b com.samsung.android.sdk.pass.d com.samsung.android.sdk.pass.e

This warning even though it's set for 7.0: [].Droid.csproj: Warning XA0105: The $(TargetFrameworkVersion) for Plugin.Fingerprint.dll (v7.0) is greater than the $(TargetFrameworkVersion) for your project (v6.0). You need to increase the $(TargetFrameworkVersion) for your project. (XA0105) (EmployeePortal.Droid)

ronpf commented 8 years ago

Have you tried a release build with proguard on? Seeing a slew of new error messages after build failure. Error: Tool exited with code: 1. Output: ProGuard, version 5.2.1

ronpf commented 8 years ago

Seeing this at runtime. I added the permission to the manifest but got same error on next build:

[SamsungFingerprintImplementation] java.lang.SecurityException: com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY permission is required.

smstuebe commented 8 years ago

Hmm the permission thing should work. I tested it with the sample app and a Samsung Galaxy S5. Cleared cache/bin/obj? I had this problem in the beginning of the samsung development, too and I don't know what the reason was :( It somehow disappeared.

ronpf commented 8 years ago

After a good scrubbing it's working now! It's a little awkward because if your finger touches the screen during the swipe it releases the dialog. The iPhone is a press not a swipe and works much more reliably. Thanks for the great work...again!

smstuebe commented 8 years ago

For the "if your finger touches the screen during the swipe it releases the dialog" see my todo:

image

ronpf commented 8 years ago

Perfect

ronpf commented 8 years ago

Any timeframe on the release for the droid dialog release issue? I'm prepping for a release and am not sure if I should wait or release as is.

Also, during multiple swipe/dialog release/ auth failure the app crashed and Insights reported this error. I'm sure after you get this issue fixed we should not encounter this "confused" state case.

System.InvalidOperationExceptionAn attempt was made to transition a task to a final state when it had already completed.

System.Threading.Tasks.TaskCompletionSource.SetResult(TResult result):0 Plugin.Fingerprint.Dialog.FingerprintDialogFragment.d17.MoveNext():0 Android.App.SyncContext.cAnonStorey0.<>m__0()<002bead4a13b4cf2b631f21914aa8693>:0 Java.Lang.Thread.RunnableImplementor.Run()<002bead4a13b4cf2b631f21914aa8693>:0 Java.Lang.IRunnableInvoker.n_Run(IntPtr jnienv, IntPtr native__this)<002bead4a13b4cf2b631f21914aa8693>:0 at (wrapper dynamic-method) System.Object:22b1c88a-be76-4cc8-9549-5a9038da9f1b (intptr,intptr)

smstuebe commented 8 years ago

Ye the problem is if the dialog gets dismissed this way, it doesn't get handled. I'll just disable tap to dismiss and return cancel if the user presses the back button

smstuebe commented 8 years ago

Timeframe is: now ;) beta4 is on nuget. have fun

ronpf commented 8 years ago

You're the man! Working great now!

ronpf commented 8 years ago

one last thing...Is there a way to turn off, clear, or change the dialogs "Use Fallback" text?

ronpf commented 8 years ago

and...If fallback is used the next dialog launch displays a red fingerprint, then errors out with this:

[SamsungFingerprintImplementation] java.lang.IllegalStateException: Identify request is denied because a previous request is still in progress. [SamsungFingerprintImplementation] at com.samsung.android.sdk.pass.SpassFingerprint.startIdentify(Unknown Source) [SamsungFingerprintImplementation] at md50f43c0682328aa5a68ea648e5a817861.FingerprintDialogFragment.n_onResume(Native Method) [SamsungFingerprintImplementation] at md50f43c0682328aa5a68ea648e5a817861.FingerprintDialogFragment.onResume(FingerprintDialogFragment.java:44) [SamsungFingerprintImplementation] at android.app.Fragment.performResume(Fragment.java:2329) [SamsungFingerprintImplementation] at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1023) [SamsungFingerprintImplementation] at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1163) [SamsungFingerprintImplementation] at android.app.BackStackRecord.run(BackStackRecord.java:793) [SamsungFingerprintImplementation] at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1552) [SamsungFingerprintImplementation] at android.app.FragmentManagerImpl$1.run(FragmentManager.java:487) [SamsungFingerprintImplementation] at android.os.Handler.handleCallback(Handler.java:739) [SamsungFingerprintImplementation] at android.os.Handler.dispatchMessage(Handler.java:95) [SamsungFingerprintImplementation] at android.os.Looper.loop(Looper.java:158) [SamsungFingerprintImplementation] at android.app.ActivityThread.main(ActivityThread.java:7224) [SamsungFingerprintImplementation] at java.lang.reflect.Method.invoke(Native Method) [SamsungFingerprintImplementation] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) [SamsungFingerprintImplementation] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

smstuebe commented 8 years ago

.Is there a way to turn off, clear, or change the dialogs "Use Fallback" text?

Yes, see the example. You can customize Reason, Cancel title, Fallback title. Turning off makes no sense in my opinion, because on other platforms you can't disable it. If you want to disable it, you can inherit from FingerprintDialogFragment and override OnCreateView. I'll add some virtuals to some function and maybe refactor it a bit to be more Open-Closed.

public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
    var view = base.OnCreateView(inflater, container, savedInstanceState);
    view.FindViewById<Button>(Resource.Id.fingerprint_btnFallback).Visibility = ViewStates.Gone;
    return view;
}

and then use CrossFingerprint.SetDialogFragmentType<MyCustomDialogFragment>();

If fallback is used the next dialog launch displays a red fingerprint, then errors out with this:

I never got this error in this scenario. Is it reproducable?

ronpf commented 8 years ago

Ok thanks. The error is a moot point for me because I'm removing the "use fallback" option but you might be able reproduce it by having a failed print, selecting cancel and fallback in rapid succession, in random orders.

smstuebe commented 8 years ago

"rapid succession" = while the animation is running? Or "normal" use?