Open bg7523 opened 5 years ago
No idea. All of this code is auto generated. Which version of the Android SDK wrapper are you using? Some of the older ones may not be cleaned of circular references.
android-23 I'll test and check my Delphi code for the error again. Thanks
Excuse me, I downloaded the file from https://github.com/FMXExpress/android-object-pascal-wrapper and made some minor changes, JClass => Jlang_Class Otherwise I will get a lot of circular references. I tried to use them in delphi, but I got an error "java.lang.IllegalArgumentException: andriod.hardware.fingerprint.FingerprintManager $ AuthenticationCallback is not an interface." I am a beginner of delphi. Can you help me, thank you!
uses ... ... android.Hardware.fingerprint.FingerprintManager, android.app.KeyguardManager, android.Hardware.fingerprint.FingerprintManager_AuthenticationCallback, android.Hardware.fingerprint.FingerprintManager_AuthenticationResult;
type TAuthCallback = class(TJavaLocal, JFingerprintManager_AuthenticationCallback) { [JavaSignature('android/hardware/fingerprint/FingerprintManager$AuthenticationCallback')] JFingerprintManager_AuthenticationCallback = interface(IJavaInstance) //Fixed me: JObject => IJavaInstance } public procedure onAuthenticationError(errorCode : Integer; errString : JCharSequence) ; cdecl; procedure onAuthenticationFailed ; cdecl;
procedure onAuthenticationHelp(helpCode : Integer; helpString : JCharSequence) ; cdecl;
end;
... ...
var JObject: JObject; FingerprintManager: JFingerprintManager; begin JObject:= TAndroidHelper.Context.getSystemService (TJContext.JavaClass.FINGERPRINT_SERVICE); FingerprintManager := TJFingerprintManager.Wrap ((JObject as ILocalObject).GetObjectID);
if FingerprintManager.isHardwareDetected then begin if FingerprintManager.hasEnrolledFingerprints then begin FingerprintManager.authenticate(nil, nil, 0, AuthCallback, nil); //AuthCallback := TAuthCallback.Create; end else raise Exception.Create(''没有指纹录入!'); end else raise Exception.Create('不支持指纹识别!'); end;