Jump to content
Bart Kindt

TLocationlistener.. fails in Delphi 12.

Recommended Posts

In my Android app, in the Service, I have code which in Delphi 12 no longer works, and I don't understand why:

 

Type

  TLocationListener = class; // <<<<[DCC Error] DTBU.pas(39): E2291 Missing implementation of interface method JLocationListener.onFlushComplete

 

// Then in TDTBThread:

locationListener : TLocationListener;

 

// then further down:

type 

  TLocationListener = class(TJavaLocal, JLocationListener)
  public
    constructor Create;
    procedure onLocationChanged(location: JLocation); overload; cdecl;
    procedure onLocationChanged(locations: JList); overload; cdecl;
    procedure onProviderDisabled(provider: JString); cdecl;
    procedure onProviderEnabled(provider: JString); cdecl;
    procedure onStatusChanged(provider: JString; status: Integer; extras: JBundle); cdecl;

  end;

 

The code is from years ago; Should I do it in a different way?

 

Share this post


Link to post
1 minute ago, Bart Kindt said:

E2291 Missing implementation of interface method JLocationListener.onFlushComplete

Your TLocationListener does not implement onFlushComplete, which was added to JLocationListener in Delphi 12:

  JLocationListener = interface(IJavaInstance)
    ['{D1CF3FB5-3BCB-4959-98D7-BD4D8F93D839}']
    procedure onFlushComplete(requestCode: Integer); cdecl;
    procedure onLocationChanged(location: JLocation); cdecl; overload;
    procedure onLocationChanged(locations: JList); cdecl; overload;
    procedure onProviderDisabled(provider: JString); cdecl;
    procedure onProviderEnabled(provider: JString); cdecl;
    procedure onStatusChanged(provider: JString; status: Integer; extras: JBundle); cdecl;//Deprecated
  end;

 

Share this post


Link to post

That fixed it... I had no idea that it was _required_ that the 'missing' procedure had to be added in the final source code, as I am not going to use it...

 

Big thanks Dave.

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×