FMXExpress / android-object-pascal-wrapper

Object Pascal (Delphi) JNI wrappers for the Android SDK.
http://www.fmxexpress.com/
88 stars 52 forks source link

[help me] ]I used android-object-pascal-wrapper, and need some help #3

Open bg7523 opened 5 years ago

bg7523 commented 5 years ago

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;

procedure onAuthenticationSucceeded(result : JFingerprintManager_AuthenticationResult) ; 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;

FMXExpress commented 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.

bg7523 commented 5 years ago

android-23 I'll test and check my Delphi code for the error again. Thanks