-
Content Count
1608 -
Joined
-
Last visited
-
Days Won
36
Posts posted by Dave Nottage
-
-
8 hours ago, valdiralbertod@gmail.com said:Anexo a configuração do Java.
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.
-
1
-
-
5 hours ago, Clayton A. Alves said:Is there any property or configuration that I can set to make the TButton version respond faster ?
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.
-
1 minute ago, valdiralbertod@gmail.com said:When trying to compile (F9) an application in Delphi 10.4 (Firemnokey for Android) for the application store generating an .aab file, we are getting the following error: [PAClient Error] Error: E6404 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.
-
1
-
-
8 minutes ago, David Schwartz said:It seems that when you cut through all of the handwaving and BS that Apple, VMWare, and Parallels Marketing machines have published, the answer is a flat NO, IT'S NOT POSSIBLE.
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
-
1
-
1
-
-
4 hours ago, ToddFrankson said:Is there a way to do what I want?
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.
-
1 hour ago, Rollo62 said:Perhaps the TMS FNC solutions are a more stable alternative
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.
-
2 minutes ago, Lachlan Gemmell said:I'm assuming this the process you're referring to.
Yes
2 minutes ago, Lachlan Gemmell said:OK, so an equivalent to your Apple ID button component in Kastri.
Judging by the documentation for Wallet and PayButton, I expect it will be a bit more involved, but yes.
3 minutes ago, Lachlan Gemmell said:Does this mean writing a Delphi wrapper around the Java PaymentsClient class?
If by "wrapper" you mean "Delphi code that uses PaymentsClient", then yes 🙂
10 minutes ago, Lachlan Gemmell said:Can you think of any comparable code in Kastri for this task?
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.
-
9 hours ago, Lachlan Gemmell said:I'm guessing quite a lot but maybe someone here knows more?
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.
-
1 minute ago, ToddFrankson said:Options := TNSMutableDictionary.Wrap(TNSMutableDictionary.OCClass.dictionary);
This should be:
Options := TNSMutableDictionary.Create;
5 minutes ago, ToddFrankson said:Options.setObject(TNSColor.Wrap(TNSColor.OCClass.whiteColor), NSWorkspaceDesktopImageFillColorKey);
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)
-
1
-
-
14 minutes ago, ToddFrankson said:I believe Dave Nottage posted it
I did? 🙂
15 minutes ago, ToddFrankson said:My problem has been the 3rd parameter in SetDesktopImageURL....
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.
-
On 12/10/2024 at 5:48 PM, ertank said:But that code gives me
Invoke error: method not found.
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)
-
6 hours ago, Vanar said:Tell me, how can I programmatically control the screen brightness under 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;
-
1
-
-
14 minutes ago, Ian Branch said:I ran up against an issue with paszip.pas
If it's the one from Mormot (which it seems to be, given your info), you should file an issue here.
-
Just now, David Schwartz said:What I mean is, can you compile for Intel platforms and test them?
Since Windows ARM can run x86 code, yes.
Just now, David Schwartz said:I seem to recall there's a translation layer that came with the M-series chips, but I don't hear much about it when it comes to using Delphi to build WinTel code.
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.
-
1
-
-
Just now, David Schwartz said:I don't know what VMs let you run Windows on non-Intel Macs -- I think VMWare Fusion is the only one ... does anybody know for sure? (I don't have an M-series Mac so I'm wondering.)
Parallels allows you to run Windows ARM VMs on M-series Macs
-
1
-
-
6 minutes ago, KimHJ said:Great, that did it.
Good to hear, but does that mean it now compiles, or that your app is working also? 🙂
-
11 minutes ago, KimHJ said:Does it looks like Java2Op created some wrong classes?
Is it something i can correct manually?
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.
-
1
-
-
3 hours ago, KimHJ said:The SDK is 18mb here is my dropbox link.
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.
-
1
-
34 minutes ago, iken said:But as a result, I can open the photo album and select the picture, but onActivityResult is not run after selecting the picture.
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
-
1
-
-
9 minutes ago, KimHJ said:intent.setClassName("recieptservice.com.recieptservice", "recieptservice.com.recieptservice.service.PrinterService");
I do not see the recieptservice.com.recieptservice.service.PrinterService class anywhere in the .jar file you attached. Did you compile the .jar yourself?
12 minutes ago, KimHJ said:When I look at the Android example code..
Where is this example code?
-
6 minutes ago, KimHJ said:I have attached it here.
Thanks. It appears you should use TJPrinterInterface_Default, rather than TJPrinterInterface.
-
2 minutes ago, KimHJ said:Now I get exception 6 in the create line.
Do I call the wrong class?
Possibly, but it's hard to tell without access to the .jar. You have not answered this:
On 11/16/2024 at 3:33 PM, Dave Nottage said:Is the .jar file available publicly?
If it is public, where can it be obtained from?
-
1 hour ago, KimHJ said:I did not see anything about adding the aidl in Embarcadero's website about jar files.
That's because you don't need to.
1 hour ago, KimHJ said:Could this be because I used the aidl file to create the JavaInterfaces.pas?
Possibly - the Java signatures in that file look a bit odd. Is the .jar file available publicly?
-
2 hours ago, KimHJ said:Google AI suggested that I use the Android Api contentResolver
Is there some reason why you haven't included here what it suggested?
2 hours ago, KimHJ said:but I'm unable locate that unit.
You can access the ContentResolver via: TAndroidHelper.Context.getContentResolver, by including the Androidapi.Helpers unit.
Regardless, I expect you'll need to use a library such as smbj to access files via Windows shares, which means either finding a Delphi implementation or creating imports and writing the code yourself that uses smbj (or some other library that does the same thing).
GPS and edgeBrowser
in Algorithms, Data Structures and Class Design
Posted
It might help to show the code you're using to do this.