android-object-pascal-wrapper icon indicating copy to clipboard operation
android-object-pascal-wrapper copied to clipboard

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

Open bg7523 opened this issue 7 years ago • 2 comments

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;

bg7523 avatar Nov 12 '18 13:11 bg7523

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.

FMXExpress avatar Nov 12 '18 18:11 FMXExpress

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

bg7523 avatar Nov 13 '18 04:11 bg7523