Jump to content

Dave Nottage

Members
  • Content Count

    1587
  • Joined

  • Last visited

  • Days Won

    36

Everything posted by Dave Nottage

  1. Dave Nottage

    Error Could not find program, C:\bin\\java.exe

    Start by uninstalling that version of AdoptOpenJDK (v21) and installing the correct version (v8). There is a direct link to it in the article I mentioned, i.e. this download link. It's also possible that you have other JDKs installed which are causing interference. Check the system Path variable and remove any others from it.
  2. Dave Nottage

    KastriFree FCMRebooted push notication firebase

    Sounds like there may be something wrong with the payload you are sending. You need to debug the SendPushNotificationNewVersion method to see what the value of LJSON is.
  3. Dave Nottage

    KastriFree FCMRebooted push notication firebase

    You have not included the Execute method implementation in the example. Also, you do not show how SendPushNotificationNewVersion is being called.
  4. Dave Nottage

    GPS and edgeBrowser

    Unless you use the Google Maps (JavaScript) API, I think you may need to live with the fact that the page "flashes".
  5. Dave Nottage

    GPS and edgeBrowser

    It might help to show the code you're using to do this.
  6. Dave Nottage

    Error Could not find program, C:\bin\\java.exe

    As per the installation notes, Delphi 10.4 requires AdoptOpenJDK 8. This article includes some instructions on how to install it. Please just focus on the part regarding AdoptOpenJDK. After it is installed, you'll need to change the Java part of the SDK settings in Delphi.
  7. Dave Nottage

    Slow response on TButton click

    It might help to indicate which version of Delphi. I have similar code that as far as I can remember worked OK on (real) devices with Android 8 or lower (using Delphi 12), however I no longer have access to them. It might also help to create a reproducible test case, in case someone else has such a device. I could try it out on an emulator, though.
  8. Dave Nottage

    Error Could not find program, C:\bin\\java.exe

    Is this happening only when attempting to generate an .aab (as opposed to .apk)? Please show what the Java settings are for your Delphi installation.
  9. Dave Nottage

    Anybody have Delphi running in a VM on M-series Mac?

    I can imagine that is the case. From (my sketchy) memory, I think I did investigate moving from an older VM, but in the end I started a new one. I tend to have as little installed on the VM as possible, so it wasn't difficult to bring one "up to speed" I have a Macbook Pro with an M1 Max, running a Windows 11 Arm VM (one with Delphi 12.2 and one with Delphi 11.3) using Parallels 20.1.1
  10. Dave Nottage

    Android/IOS push notifications...

    If the app is not already running, you need to handle startup notifications. See part 10 of these instructions, which deals with handling the StartupNotifications property.
  11. Dave Nottage

    Google Pay and Apple Pay

    Not sure what you mean by "more" stable, if an out of the box solution does not exist? In any event, TMS PassKit is for VCL, and deals with PassKit files, not PassKit itself.
  12. Dave Nottage

    Google Pay and Apple Pay

    Yes Judging by the documentation for Wallet and PayButton, I expect it will be a bit more involved, but yes. If by "wrapper" you mean "Delphi code that uses PaymentsClient", then yes 🙂 Perhaps the GoogleSignIn feature might come closest, however they're all fairly diverse (check units that end with .Android.pas in the subfolders of the Features folder). I expect using PaymentsClient (and the Wallet class) may be more complex than the others.
  13. Dave Nottage

    Google Pay and Apple Pay

    I've done something similar for the AppleID button, here and here, and I suspect PKPaymentButton will be similar. You'll need an import for PassKit, too. As for the PayButton from Google, you'll need to get the play-services-wallet package (which means obtaining any dependencies not already in the "default" jars in Delphi), then import the relevant classes before creating the same kind of code as for PKPaymentButton, but for the PayButton, for Android, as well as writing the code that uses the PaymentsClient class.
  14. Dave Nottage

    MACOS "setDesktopImageURL"

    This should be: Options := TNSMutableDictionary.Create; This should be: Options.setObject(TNSColor.OCClass.whiteColor, NSObjectToID(NSWorkspaceDesktopImageFillColorKey)); Since setObject takes pointer parameters, for both. The rest should follow the same rule. Incidentally, there's loads of examples of using an NSMutableDictionary in the Delphi source (as well as in Kastri)
  15. Dave Nottage

    MACOS "setDesktopImageURL"

    I did? 🙂 This code works for me: procedure SetDesktopBackground(const ImagePath: string; const FillColor: TAlphaColor); var NSFileURL: NSURL; NSWorkspace1: NSWorkspace; MainScreen: NSScreen; LPointer: Pointer; Error: NSError; begin try // Convert Delphi file path to NSURL NSFileURL := TNSURL.Wrap(TNSURL.OCClass.fileURLWithPath(StrToNSStr(ImagePath))); NSWorkspace1 := TNSWorkspace.Wrap(TNSWorkspace.OCClass.sharedWorkspace); MainScreen := TNSScreen.Wrap(TNSScreen.OCClass.mainScreen); LPointer := nil; // Set the desktop image for the main screen if not NSWorkspace1.setDesktopImageURL(NSFileURL, MainScreen, nil, @LPointer) then begin Error := TNSError.Wrap(LPointer); ShowMessage('Failed to set desktop image: ' + NSStrToStr(Error.localizedDescription)); end; except on E: Exception do begin ShowMessage('Error setting desktop image: ' + E.Message); end; end; end; If you're having trouble creating a dictionary for the options, please show what code you attempted.
  16. Dave Nottage

    Android short time format 24h/12h

    The method name is24HourFormat, not is24hourformat, and is also a static method, so the declaration should be: JDateFormatClass = interface(JObjectClass) ['{E9A75876-EDA1-44CE-B159-46BACF1805F7}'] {class} function is24HourFormat(context: JContext): Boolean; cdecl; end; [JavaSignature('android/text/format/DateFormat')] JDateFormat = interface(JObject) ['{65E305D7-04D6-4C33-8AB0-9FE366F3F24D}'] end; TJDateFormat = class(TJavaGenericImport<JDateFormatClass, JDateFormat>) end; ..and called like this: uses Androidapi.Helpers; procedure TForm1.FormCreate(Sender: TObject); begin if TJDateFormat.JavaClass.is24HourFormat(TAndroidHelper.Context) then // is 24 hour else // is 12 hour end; Note that I have not tested the code above - I am just going by the documentation (which I linked to)
  17. Dave Nottage

    Screen Brightness in iOS

    uses iOSapi.Helpers; function GetBrightness: Single; begin Result := TiOSHelper.MainScreen.brightness; end; procedure SetBrightness(const AValue: Single); begin if (AValue >= 0) and (AValue <= 1) then TiOSHelper.MainScreen.setBrightness(AValue); end;
  18. Dave Nottage

    PasZip.pas Issue.

    If it's the one from Mormot (which it seems to be, given your info), you should file an issue here.
  19. Dave Nottage

    Buying a mini pc to install Delphi

    Since Windows ARM can run x86 code, yes. Rosetta on Mac doesn't have anything to do with the above, as far as I know - that's just for whether Intel macOS apps would be able to run in the Mac host.
  20. Dave Nottage

    Buying a mini pc to install Delphi

    Parallels allows you to run Windows ARM VMs on M-series Macs
  21. Dave Nottage

    Android aidl error when using it.

    Good to hear, but does that mean it now compiles, or that your app is working also? 🙂
  22. Dave Nottage

    Android aidl error when using it.

    Yes - you can safely remove any declarations that have a signature that ends with $ and a number (and remove the corresponding xxxClass declarations), as these are anonymous inner classes.
  23. Dave Nottage

    Android aidl error when using it.

    The file printer.jar in the SDK appears to be a cut-down version (not sure why they provide it in the first place - it might be in error) of the one you actually need to use, which is inside printer-release.aar. If you have Delphi 12.2, you can add this file to the Libraries node under Android 32-bit target in Project Manager instead of printer.jar. This library includes the required methods of SrPrinter (e.g. getInstance), so you should be able to use this function to get an instance of it: uses Androidapi.Helpers; function SrPrinter: JSrPrinter; begin Result := TJSrPrinter.JavaClass.getInstance(TAndroidHelper.Context); end; ..and call the functions like they do in the Java examples, e.g.: SrPrinter.printQRCode(StringToJString('123456'), 4, 3); However you will need to first: Rename printer-release.aar to printer-release.zip Extract the classes.jar file from the .zip file Run Java2OP on the extracted classes.jar to recreate your JavaInterfaces.pas import.
  24. You need to do it this way, for example: unit Unit1; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, System.Messaging, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Controls.Presentation, FMX.StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private procedure MessageResultNotificationMessageHandler(const Sender: TObject; const M: TMessage); public constructor Create(AOwner: TComponent); override; destructor Destroy; override; end; var Form1: TForm1; implementation {$R *.fmx} uses Androidapi.Helpers, Androidapi.JNI.App, Androidapi.JNI.GraphicsContentViewText; const cRequestCode = 1234; // Just a random number constructor TForm1.Create(AOwner: TComponent); begin inherited; TMessageManager.DefaultManager.SubscribeToMessage(TMessageResultNotification, MessageResultNotificationMessageHandler); end; destructor TForm1.Destroy; begin TMessageManager.DefaultManager.Unsubscribe(TMessageResultNotification, MessageResultNotificationMessageHandler); inherited; end; procedure TForm1.MessageResultNotificationMessageHandler(const Sender: TObject; const M: TMessage); var LMessage: TMessageResultNotification; begin LMessage := TMessageResultNotification(M); if LMessage.RequestCode = cRequestCode then begin if LMessage.ResultCode = TJActivity.JavaClass.RESULT_OK then begin // Here, handle the Intent that is the LMessage.Value property end; end; end; procedure TForm1.Button1Click(Sender: TObject); var LIntent: JIntent; begin LIntent := TJIntent.Create; LIntent.setAction(TJIntent.JavaClass.ACTION_PICK); LIntent.setType(StringToJString('image/*')); TAndroidHelper.Activity.startActivityForResult(LIntent, cRequestCode); end; end
  25. Dave Nottage

    Android aidl error when using it.

    I do not see the recieptservice.com.recieptservice.service.PrinterService class anywhere in the .jar file you attached. Did you compile the .jar yourself? Where is this example code?
×