-
Content Count
1626 -
Joined
-
Last visited
-
Days Won
37
Everything posted by Dave Nottage
-
There's an import for TelecomManager, here: https://github.com/FMXExpress/android-object-pascal-wrapper/blob/master/android-28/android.telecom.TelecomManager.pas Be aware that Java2Pas (which was used for the import) sometimes puts instance methods where the class methods are, so they should be removed from there in the import. getCallCapablePhoneAccounts is an instance method that returns a JList, containing instances of JPhoneAccountHandle, so one way to access them is to do this: var LService: JObject; LAccounts: JList; LPhoneAccountHandle: JPhoneAccountHandle; I: Integer; begin Result := False; LService := TAndroidHelper.Context.getSystemService(TJContext.JavaClass.TELECOM_SERVICE); LAccounts := TJTelecomManager.Wrap(TAndroidHelper.JObjectToID(LService)).getCallCapablePhoneAccounts; for I := 0 to LAccounts.size - 1 do begin LPhoneAccountHandle := TJPhoneAccountHandle.Wrap(TAndroidHelper.JObjectToID(LAccounts.get(I))); // Do whatever with the LPhoneAccountHandle here end; end; An import for PhoneAccountHandle is here: https://github.com/FMXExpress/android-object-pascal-wrapper/blob/master/android-28/android.telecom.PhoneAccountHandle.pas Note that getCallCapablePhoneAccounts was introduced in API level 23.
-
I was originally using some Indy code, however I figured I strip back the code to the absolute basics in order to try and find out what is going wrong. This is the result: uses Posix.SysSocket, Posix.NetinetIn, Posix.ArpaInet; const // IPv6 address of en0 on my Mac cIPv6 = 'fe80::ca9:418d:c487:cba'; cPort = 9099; procedure TForm1.Button1Click(Sender: TObject); var LHandle, LOption, LError: Integer; LSockAddrIPv6: sockaddr_in6; LNetAddrIPv6: in6_addr; LMarshaller: TMarshaller; LMsg: string; begin LHandle := socket(AF_INET6, SOCK_DGRAM, 0); if LHandle > 0 then begin LOption := 1; if setsockopt(LHandle, SOL_SOCKET, SO_REUSEADDR, LOption, SizeOf(LOption)) = 0 then begin if inet_pton(AF_INET6, LMarshaller.AsAnsi(cIPv6).ToPointer, @LNetAddrIPv6) = 1 then begin FillChar(LSockAddrIPv6, SizeOf(LSockAddrIPv6), 0); LSockAddrIPv6.sin6_len := SizeOf(LSockAddrIPv6); LSockAddrIPv6.sin6_family := AF_INET6; LSockAddrIPv6.sin6_addr := LNetAddrIPv6; LSockAddrIPv6.sin6_port := htons(cPort); if bind(LHandle, PSockAddr(@LSockAddrIPv6)^, SizeOf(LSockAddrIPv6)) = -1 then begin LError := GetLastError; ShowMessage(SysErrorMessage(LError)); end; end; end; end; end; The bind fails, however I'm yet to be able to ascertain why. The error code returned in LError is 49, which apparently equates to: "Can't assign requested address". Any ideas on what the problem might be? The same code also fails on iOS (using a valid IPv6 address), so is it perhaps an Apple thing?
-
Cannot bind an IPv6 address on macOS
Dave Nottage replied to Dave Nottage's topic in Network, Cloud and Web
The simplified version (as per the example) would look like this: LSockAddrIPv6.sin6_scope_id = 4; Because the index of the interface in question is 4. I've been working on some "home grown" (i.e. not Indy) code that includes retrieving the local addresses and interface indexes so that they can be used for this kind of thing (amongst others). The purpose is to have a reliable, functional means of advertising that works on all platforms, using IPv4, IPv6 and works on IPv6 only networks. I've diverged from Indy because I was having to jump through too many hoops in order to make it all work, and to simplify everything. I plan on publishing the code when it is complete. -
Cannot bind an IPv6 address on macOS
Dave Nottage replied to Dave Nottage's topic in Network, Cloud and Web
I've finally discovered the problem: The sin6_scope_id member of LSockAddrIPv6 needed to be set to the index of the interface that has the address. -
Your code does not match the Java equivalent that has been sent to you. This is the equivalent: uses Androidapi.JNI.GraphicsContentViewText, Androidapi.JNI.Net, Androidapi.Helpers; procedure TForm1.Button1Click(Sender: TObject); var MobileNumber: string; Intent: JIntent; begin MobileNumber := '*155#'; Intent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_CALL); Intent.putExtra(StringToJString('com.android.phone.extra.slot'), 1); Intent.putExtra(StringToJString('simSlot'), 1); Intent.setData(TJnet_Uri.JavaClass.parse(StringtoJString('tel:' + MobileNumber))); TAndroidHelper.Context.startActivity(Intent); end; I don't have a dual SIM device to test this. Those are not equivalent. TJIntent.JavaClass.EXTRA_PHONE_NUMBER is "android.intent.extra.PHONE_NUMBER", not "com.android.phone.extra.slot"
-
If you're not doing anything beyond using them while the app is in the foreground, then you probably won't have any issues. Try using them (on iOS or Android) when the app is in the background, or not running. Rollo may have been referring to them as being supported in the RTL, rather than users having to write more code to use them, such as Xcode and Android Studio developers do.
-
Delphi 10.3 and supported version of Android
Dave Nottage replied to Yaron's topic in Delphi IDE and APIs
You can change it in AndroidManifest.Template.xml, i.e. replace %minSdkVersion% with whatever value you think should be the minimum. As per the previous replies, making this value higher will exclude as many users that have a lower version. -
Simple Android App Template
Dave Nottage replied to microtronx's topic in Job Opportunities / Coder for Hire
I can help particularly with this part if you're interested. -
From the pic, you've created a profile for a Windows PAServer. If deploying to iOS simulator, you need to create/use one for macOS. If you are using macOS 10.15.x, it will all be for nought because the 32-bit portion of PAServer will not run. If your macOS version is earlier, read on.... You'll also need to install an iOS 10.3 simulator (using Xcode) because Delphi does not currently support later simulators. In the Xcode menu click Window > Devices and Simulators, select the Simulators tab and click the "+" button in the bottom left:
-
Thanks for the changes.. but does it work? 😉
- 12 replies
-
If FStillImageOutput is a AVCaptureStillImageOutput, you could do this: AVCaptureStillImageOutput = interface(iOSapi.AVFoundation.AVCaptureStillImageOutput) ['{A1669519-9901-489E-BDD1-A0E697C8C6CB}'] procedure addObserver(observer: NSObject; forKeyPath: NSString; options: NSKeyValueObservingOptions; context: Pointer); cdecl; end; TAVCaptureStillImageOutput = class(TOCGenericImport<AVCaptureStillImageOutputClass, AVCaptureStillImageOutput>) end; ... TAVCaptureStillImageOutput.Wrap(FStillImageOutput).addObserver(FVideoCaptureDelegate, NSObjectToID(StrToNSStr('capturingStillImage')), NSKeyValueObservingOptionNew, NSObjectToID(FAVCaptureStillImageIsCapturingStillImageContext)); NSObjectToID comes from Macapi.Helpers
- 12 replies
-
Unknown function at TMethodImplementationIntercept
Dave Nottage replied to pyscripter's topic in RTL and Delphi Object Pascal
Does this help? https://wiert.me/2018/06/01/unknown-function-at-tmethodimplementationintercept/ -
For this latest issue, see this link: https://stackoverflow.com/a/50779232/3164070
-
This line is interesting: 12-06 00:30:44.030: I/agamama.orderc(31926): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.arch.lifecycle.LifecycleOwner" on path: DexPathList[[zip file "/data/app/cy.com.wagamama.ordercy-qsEct8E2Xh8zg2XEtOetZg==/base.apk"],nativeLibraryDirectories=[/data/app/cy.com.wagamama.ordercy-qsEct8E2Xh8zg2XEtOetZg==/lib/arm, /data/app/cy.com.wagamama.ordercy-qsEct8E2Xh8zg2XEtOetZg==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]] 12-06 00:30:44.030: I/agamama.orderc(31926): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.arch.lifecycle.LifecycleOwner" on path: DexPathList[[zip file "/data/app/cy.com.wagamama.ordercy-qsEct8E2Xh8zg2XEtOetZg==/base.apk"],nativeLibraryDirectories=[/data/app/cy.com.wagamama.ordercy-qsEct8E2Xh8zg2XEtOetZg==/lib/arm, /data/app/cy.com.wagamama.ordercy-qsEct8E2Xh8zg2XEtOetZg==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]] Because android.arch.lifecycle.LifecycleOwner has long been deprecated: https://developer.android.com/reference/android/arch/lifecycle/LifecycleOwner Is there perhaps some 3rd party library you're using that's expecting this class to be present? It may be present on the devices (for compatibility) that your app works on. Not sure if this is the root cause of your problem, but it might be worth looking at.
-
Does your app perform any network calls at all? If your package is cy.com.wagamama.ordercy, the log line at 12-05 18:34:30.888 seems to indicate it is doing at least something network related, and appears to be the source of the crash.
-
Known issue: https://quality.embarcadero.com/browse/RSP-27035 Check Marco's comment on the report.
-
Android Compiler Issue in Delphi Tokyo (10.2.3)
Dave Nottage replied to Ugochukwu Mmaduekwe's topic in Delphi IDE and APIs
The Java source which is here: https://github.com/DelphiWorlds/KastriFree/tree/master/Java Was published at the same time as the demo and .jar file. -
Barcode reading on Honeywell and Zebra devices
Dave Nottage replied to Cristian Peța's topic in I made this
You realise you don't actually need to subclass the Activity? You do however need to have a class that implements EMDKListener, StatusListener, DataListener. I went through the process of implementing this a couple of years ago. Looking at the code now, it might even be possible to do it completely in Delphi. -
Android Compiler Issue in Delphi Tokyo (10.2.3)
Dave Nottage replied to Ugochukwu Mmaduekwe's topic in Delphi IDE and APIs
It has no dependency on any Delphi version, if that's what you meant. I just tried compiling it in Delphi 10.1 Berlin with the correct SDK settings (as per my last message) and there were no errors. -
Android Compiler Issue in Delphi Tokyo (10.2.3)
Dave Nottage replied to Ugochukwu Mmaduekwe's topic in Delphi IDE and APIs
It's not the problem, since it compiles fine for me, and others - see this link: i.e. Yaron has been able to compile using the .jar On my machine, I have Android SDK 25.2.5, and the following settings reflected in the Delphi SDK manager: Build tools: 28.0.3 (this path is used for things like ZipAlign.exe and Aapt.exe) Platform: android-28 JDK: 1.8.0_191 (C:\Program Files\Java\jdk1.8.0_191\bin is the *only* entry pointing to a JDK in the PATH environment variable) I'm pretty sure those are the ones that matter. -
Service Location Protocol API pascal unit?
Dave Nottage replied to eivindbakkestuen's topic in Network, Cloud and Web
Have you checked this out? https://torry.net/authorsmore.php?id=4244 -
I've modified the Java code and published a new .jar here: https://github.com/DelphiWorlds/KastriFree/blob/master/Lib/dw-webchromeclient.jar
-
Yes, the Java code will need to be changed to parse the accept attribute (if that's possible) and set the appropriate mime types. Probably something along these lines: https://stackoverflow.com/a/55449804/3164070
-
The current version of IDE Fix Pack installs into 10.3.3. Whether it functions as expected, I know not.
-
It seems that setting the WebChromeClient works only when the TWebBrowser is visible. Move your code that creates FWebManager to just after you set VoucherimWebBrowser.Visible to True.