Jump to content

Dave Nottage

Members
  • Content Count

    1495
  • Joined

  • Last visited

  • Days Won

    36

Everything posted by Dave Nottage

  1. Reported this a couple of months ago: https://quality.embarcadero.com/browse/RSP-26998
  2. Dave Nottage

    iOS Firebase Push Notifications

    Have you tried tracing the code via the debugger? Can you provide a reproducible example?
  3. Dave Nottage

    iOS Firebase Push Notifications

    Yes, I have that issue too. I've been meaning to report the problem. It presents the prompt every time you run it? Which app is this?
  4. Dave Nottage

    Reading caller number at the same time phone is ringing

    Thanks for the tip! I wasn't aware of tags here, and they're a bit small but at least now I know to look πŸ™‚
  5. Dave Nottage

    Squint and read: CreateFormFromStings

    Not that it would affect many users (if any), but in FMX.Edit.Style: protected FNeedChange: Boolean; procedure Change; virtual; { Messages From Model} procedure MMSelLenghtChanged(var AMessage: TDispatchMessageWithValue<Integer>); message MM_EDIT_SELLENGTH_CHANGED; procedure MMSelStartChanged(var AMessage: TDispatchMessageWithValue<Integer>); message MM_EDIT_SELSTART_CHANGED; procedure MMCheckSpellingChanged(var AMessage: TDispatchMessageWithValue<Boolean>); message MM_EDIT_CHECKSPELLING_CHANGED; Spot the typo. The last method name pictured is ironic. Someone should whip up a "spell checker" (of sorts) to see how many of these there are πŸ˜‰
  6. Dave Nottage

    iOS Firebase Push Notifications

    If by "setup" you're referring to how to set up a project in Firebase Console, you should start here: ..and watch until the 4:52 mark (the rest is not relevant to Delphi) For Delphi code to implement FCM on iOS, you could refer to this article: https://www.delphiworlds.com/2020/01/expanding-embarcaderos-fcm-implementation-revisited/
  7. Dave Nottage

    Reading caller number at the same time phone is ringing

    It would help to specify which platform(s) you want to achieve this on. If it's iOS/Android, then using the OnCallStateChanged method of IFMXPhoneDialerService is supposed to allow you to know when an incoming call starts, and using the GetCurrentCalls method should contain the number. That said, iOS now restricts being able to access the actual number. Also, I know others have had problems with making IFMXPhoneDialerService work at all on Android. I don't know whether that's the case now, however I use my own (non-public) code for it anyway.
  8. Dave Nottage

    SHOpenFolderAndSelectItems 64-bit

    This person seems to have it working in 64-bit: https://forums.embarcadero.com/message.jspa?messageID=671467&tstart=0
  9. Dave Nottage

    AV with InApp purchase on MacOS

    Remove the [Weak] attribute from FIAPService. Might still be a bug, though.
  10. Apparently this is the reason: https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-hardware-id I nearly fell off my chair when I read that: essentially give up your location privacy so no-one can steal your Bluetooth Mac address? Perhaps someone else can explain why that's a good thing.
  11. Dave Nottage

    Squint and read: CreateFormFromStings

    ..or very few using that method, or very few that are vocal about the misspelling πŸ˜‰
  12. Dave Nottage

    Squint and read: CreateFormFromStings

    It was introduced in 10.3 You're right that it's not a good look. If it were me, I'd change it and take the small amount of pain (if any) from developers, who would probably understand anyway
  13. It has always needed location permissions, they just don't need to have been requested at runtime prior to Android 6.
  14. Dave Nottage

    Call from sim 2

    Actually putExtra takes a number of different types, including JParcelable. I've modified the Telecom import unit: https://github.com/DelphiWorlds/KastriFree/blob/master/API/DW.Androidapi.JNI.Telecom.pas So if you update that, it should now accept LAccountHandle
  15. Dave Nottage

    Call from sim 2

    That part should be more like this: LAccounts := TJTelecomManager.Wrap(TAndroidHelper.JObjectToID(LService)).getCallCapablePhoneAccounts; if LAccounts <> nil then begin for I := 0 to 1 do begin if LAccounts.size > I then begin LPhoneAccountHandle := TJPhoneAccountHandle.Wrap(TAndroidHelper.JObjectToID(LAccounts.get(I))); Intent.putExtra(StringToJString('android.telecom.extra.PHONE_ACCOUNT_HANDLE'), LPhoneAccountHandle); end; end; end;
  16. Happens to me, too. It seems to key on "error:" (i.e. with a colon) because this produces the same result: @echo There was not one error: everything is OK
  17. Dave Nottage

    Call from sim 2

    I've created a more compatible (with the other Delphi units) import for the Telecom classes, here: https://github.com/DelphiWorlds/KastriFree/blob/master/API/DW.Androidapi.JNI.Telecom.pas Which should at least make it a bit easier
  18. Dave Nottage

    Call from sim 2

    This is one way: if TOSVersion.Check(21) then begin // Do the TELECOM_SERVICE stuff end; TELECOM_SERVICE was introduced in API level 21. Another way is: if TJBuild_VERSION.JavaClass.SDK_INT >= 21 then begin // Do the TELECOM_SERVICE stuff end;
  19. Unless someone has done it already, I expect you're going to need to spend a fair amount of time on it. This is a starting point for the leaderboard/game saving parts: https://developers.google.com/games/services/android/leaderboards It would be a case of: Reading the documentation, and working out which parts you want to implement Working out which packages the relevant classes are in Doing imports of those classes into Delphi code Working out whether there are any classes you need to create descendants for, and writing the appropriate Java and associated Delphi code for them Implementing the various parts in Delphi Alternatively, you could implement a large portion of it in Java, create a .jar that Delphi would use and import the relevant parts into Delphi code. I note that it requires Google Sign-in, so for that part you might want to take a look at this: https://github.com/grijjy/DelphiGoogleSignIn Which is related to Firebase, however the Google Sign-In parts would be relevant.
  20. Dave Nottage

    Call from sim 2

    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.
  21. 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?
  22. Dave Nottage

    Cannot bind an IPv6 address on macOS

    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.
  23. Dave Nottage

    Cannot bind an IPv6 address on macOS

    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.
  24. Dave Nottage

    Call from sim 2

    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"
  25. Dave Nottage

    New section for native apps

    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.
Γ—