Jump to content

Dave Nottage

Members
  • Content Count

    1489
  • Joined

  • Last visited

  • Days Won

    36

Everything posted by Dave Nottage

  1. Dave Nottage

    android camera problem

    You do not create an instance of JCamera using Create. As per the documentation: Camera | Android Developers To take pictures with this class, use the following steps: Obtain an instance of Camera from open(int).
  2. Dave Nottage

    android camera problem

    I have been working on that. I needed to make a substantial change to using an OpenGL surface - a problem I am having is doing a transform when the device is not oriented in the "normal" position. That already is "tapped", however the SurfaceTextureListener is not the right place. As per my comment above, I've switched to using GLSurfaceView: https://developer.android.com/reference/android/opengl/GLSurfaceView Which uses: https://developer.android.com/reference/android/opengl/GLSurfaceView.Renderer The GLSurfaceView calls onDrawFrame of the Renderer when a new frame is available, so the capture/filtering can be done there. This part is all done in Java, however the Delphi code could "hook" into the filtering, and can already pass a Java bitmap of the resulting frame to Delphi. Again as per above, I want to resolve the transform issue which is currently eluding me. I'm willing to share the work in progress with others if they think they can help. Best to join my Slack workspace to do so: https://slack.delphiworlds.com
  3. Dave Nottage

    android camera problem

    It was pretty daunting for me: Native Camera for iOS and Android – Delphi Worlds There's still a number of issues to resolve...
  4. It appears you have already asked a similar question, here: https://stackoverflow.com/questions/65345853/is-it-possible-to-write-the-following-java-program-in-delphi The principal for your present issue is identical, i.e. if OnPrintListener is a class, then you. cannot do it in Delphi. If it's an interface (which, given your other question, it's likely), then you already have an example of how to implement a Java interface, in the StackOverflow answer. A possible example for this case: uses Androidapi.JNIBridge, Androidapi.JNI.JavaTypes, Androidapi.Helpers; type JOnPrintListener = interface; JOnPrintListenerClass = interface(IJavaClass) ['{076904DD-77D9-497D-BA21-992A9B8FED3E}'] end; [JavaSignature('com.nexgo.oaf.apiv3.device.printer.OnPrintListener')] JOnPrintListener = interface(IJavaInstance) ['{F688775D-067F-4521-A045-9106599F4C4A}'] procedure onPrintResult(retCode: Integer); cdecl; // *** NOTE *** There may be other methods for this interface end; TJOnPrintListener = class(TJavaGenericImport<JOnPrintListenerClass, JOnPrintListener>) end; TRunnable = class(TJavaLocal, JRunnable) private FCallback: TProc; public { JRunnable } procedure run; cdecl; public constructor Create(const ACallback: TProc); end; TPrintListener = class(TJavaLocal, JOnPrintListener) private FRetCode: Integer; FRunnable: JRunnable; procedure DoRun; public { JOnPrintListener } procedure onPrintResult(retCode: Integer); cdecl; public constructor Create; end; { TRunnable } constructor TRunnable.Create(const ACallback: TProc); begin inherited Create; FCallback := ACallback; end; procedure TRunnable.run; begin FCallback; end; { TPrintListener } constructor TPrintListener.Create; begin inherited; FRunnable := TRunnable.Create(DoRun); end; procedure TPrintListener.DoRun; begin // Do the toast thing here, using FRetCode end; procedure TPrintListener.onPrintResult(retCode: Integer); begin FRetCode := retCode; TAndroidHelper.Activity.runOnUiThread(FRunnable); end; { TForm1 } procedure TForm1.Button1Click(Sender: TObject); begin // Assuming FPrintListener is defined as: FPrintListener: JOnPrintListener FPrintListener := TPrintListener.Create; // Assuming you have created an instance of Printer (imported as JPrinter) called FPrinter FPrinter.startPrint(False, FPrintListener); end; Note all of the assumptions being made - the biggest one being that OnPrintListener is an interface. Also I don't have the .jar, nor the printer, so of course it is untested
  5. Unlikely. Such tools are to create imports from .jar or .class files, not convert Java code to Delphi. Your main problem will be whether OnPrintListener is a class or an interface, because you cannot implement a descendant of a Java class in Delphi - it needs to be done in Java. Java interfaces however, can be implemented in Delphi by creating a descendant of TJavaLocal, and implementing the interface in question. There are a number of examples of descendants of TJavaLocal throughout the Delphi source. In order to determine what OnPrintListener is, you could use the aforementioned tools to import the Java classes from the .jar that you mentioned, assuming that it is the one that contains com.nexgo.oaf.apiv3.
  6. Dave Nottage

    Save and get images on iOS

    Since iOS 8, use the PhotoKit framework to access photos in albums: PhotoKit | Apple Developer Documentation I have an import for it, here: https://github.com/DelphiWorlds/Kastri/blob/master/API/DW.iOSapi.Photos.pas Which likely needs updating, because I think I imported it around iOS 9 era. This will not help you however, if you are saving photos as files somewhere. You can retrieve the filename from an asset in the gallery, bearing in mind can be traps in doing so: https://medium.com/@slk11075/traps-for-phasset-how-to-get-filename-from-phasset-67d856e75c64
  7. Dave Nottage

    iOS, Error e8000084

    If you haven't already, try using a different cable
  8. Dave Nottage

    Firebase Notification

    Are you actually including that unit in your source? If so, where you have declared it, please use Ctrl-Click or right-click and Open File At Cursor. It should find it in the Delphi source in the fmx folder. If it finds it anywhere else, that's probably the issue.
  9. Dave Nottage

    Firebase Notification

    You didn't answer my other question, i.e:
  10. Dave Nottage

    I messed up my SDK and NDK Setup

    The test project: Does not have "Secure File Sharing" checked in the Entitlements section of the Project Options, Does not request the required permissions at runtime. Fixing these makes it work for me on Android 11.
  11. Dave Nottage

    RAD Studio 10.4.1 my first iOS app - can error

    iOS simulator is currently not supported. Use a real device
  12. Dave Nottage

    [Android] Hangs on splashscreen

    On Android, problems in deployment can cause the app to fail to start, however you have indicated it is also a problem on iOS, so it is more likely to be a problem with the initialization of one of the units included. Can you create a blank app that runs OK? If so, use that, and start adding your original to the project until it breaks - then you have a reproducible example.
  13. Dave Nottage

    TBitmap published property

    I have an FMX component with a published TBitmap property, but the property is not being read when the component is loaded (the other properties are). Holger Flick's article suggests that it is possible: https://flixengineering.com/archives/166 Is there something special I need to do to make it work? This is what the declaration looks like: TCustomNativeDoodad = class(TPresentedControl) private function GetMaxImage: TBitmap; function GetMinImage: TBitmap; function GetModel: TCustomNativeDoodadModel; overload; function GetValue: Single; procedure SetValue(const Value: Single); function GetOnValueChange: TNotifyEvent; function GetOrientation: TDoodadOrientation; procedure SetMaxImage(const Value: TBitmap); procedure SetMinImage(const Value: TBitmap); procedure SetOnValueChange(const Value: TNotifyEvent); procedure SetOrientation(const Value: TDoodadOrientation); protected function DefineModelClass: TDataModelClass; override; function RecommendSize(const AWishedSize: TSizeF): TSizeF; override; public constructor Create(AOwner: TComponent); override; property MaxImage: TBitmap read GetMaxImage write SetMaxImage; property MinImage: TBitmap read GetMinImage write SetMinImage; property Model: TCustomNativeDoodadModel read GetModel; property Orientation: TDoodadOrientation read GetOrientation write SetOrientation; property Value: Single read GetValue write SetValue; property OnValueChange: TNotifyEvent read GetOnValueChange write SetOnValueChange; end; [ComponentPlatformsAttribute(pfidiOS or pidAndroid)] TNativeDoodad = class(TCustomNativeDoodad) published property Align; property Anchors; property Height; property Margins; property MaxImage; property MinImage; property Orientation; property Position; property Size; property Value; property Visible default True; property Width; property OnValueChange; end; SetMaxImage and SetMinImage are not being called when the component is being loaded
  14. Dave Nottage

    TBitmap published property

    Which is the whole problem - they're not called when the values are streamed. I needed to override the Loaded method to see that they are.
  15. Dave Nottage

    [Android] Hangs on splashscreen

    If it reproduces the problem, it would be extremely useful.
  16. Dave Nottage

    Photo app for Android and iPhone

    I assume you mean do the equivalent code for iOS?
  17. Dave Nottage

    [Android] Hangs on splashscreen

    See my first reply.
  18. Dave Nottage

    Adding a new SDK for MacOS fails

    Which means you'll need to do: sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
  19. Dave Nottage

    Adding a new SDK for MacOS fails

    If you installed Delphi from scratch, you'll still need to apply the patches (there's 4) In a Terminal window on the Mac, can you run this command? /usr/bin/xcodebuild -version -sdk In the output there should be at least one entry of MacOSX
  20. Dave Nottage

    Firebase Notification

    What do you mean by hang? Have you checked to see if PushService is non-nil when executing this line? ServiceConnection := TPushServiceConnection.Create(PushService);
  21. Dave Nottage

    Firebase Notification

    Please pay attention to compiler warnings. TPushService.TServiceNames.GCM has been deprecated. Use TPushService.TServiceNames.FCM
  22. Dave Nottage

    PAServer Error: file permissions do not allow debugging

    Please see: http://docwiki.embarcadero.com/RADStudio/Sydney/en/Acquiring_Permission_to_Support_Debugging_on_a_Mac Although that page needs fixing. The file in question is: dbkosx_27_0
  23. Dave Nottage

    Discover all LAN network with a PC

    Either you posted the wrong source (a VCL app), or your question needs editing. It appears you wanted to replicate some Java code in Delphi.
  24. Dave Nottage

    Discover all LAN network with a PC

    What have you tried? Does none of it succeed, or only certain parts?
  25. Dave Nottage

    [Android] Hangs on splashscreen

    Use a logcat viewer to check the log messages for any errors. Beyond that, you're going to need to give more detail about what is in the app, and perhaps a reproducible example if possible.
×