Jump to content

Dave Nottage

Members
  • Content Count

    1489
  • Joined

  • Last visited

  • Days Won

    36

Everything posted by Dave Nottage

  1. Dave Nottage

    Drawing problem with TStatusBar

    Steps to reproduce: (Delphi 10.4.2) 1. Start new VCL app 2. Put a TStatusBar on the form 3. Right-click the TStatusBar, click Panels Editor.. 4. Click the "Add" button in the top left, 15 times (panels will be numbered 0 - 14) 5. Save the project 6. Close the form 7. Re-open the form 8. Check the appearance of the TStatusBar On the PCs I have tried this on, the status bar fails to draw correctly when first shown. If the status bar needs to repaint, all is OK. This happens both at design time and runtime. Might anyone know why this occurs, and is there a solution?
  2. Dave Nottage

    Drawing problem with TStatusBar

    OK.. it may be a problem at runtime only in some circumstances, which includes running on a remote machine. Needs further investigation in that regard
  3. Dave Nottage

    MacOS AVPlayer and DRM

    I'm interested, thanks!
  4. This looks like two questions. The first part is not currently possible using Delphi code, since there's no option to use AccessibilityService (there is for a plain Service and JobIntentService) In order to use UssdResponseCallback you need to write Java code, since you need to create a descendant of it (this is otherwise not currently possible in Delphi), and override its methods. You could define a Java interface that the descendant takes as a parameter in its constructor, and uses to redirect the overridden methods, much like I have in the code here: https://github.com/DelphiWorlds/Kastri/tree/master/Java/Base/Connectivity This Java code would need to be compiled into a jar which the Delphi app can consume. You would need to import the Java code into Delphi code. Using the same example above, this is the corresponding Delphi import: https://github.com/DelphiWorlds/Kastri/blob/master/API/DW.Androidapi.JNI.DWNetworkCallback.pas The next step is to construct a class that implements the interface defined earlier. Following the same example, that is TNetworkCallbackDelegate in this unit: https://github.com/DelphiWorlds/Kastri/blob/master/Features/Connectivity/DW.Connectivity.Android.pas You would then create an instance of the "delegate", and pass a reference to that when creating an instance of the descendant. Again following the above example, it would be similar to the code here: https://github.com/DelphiWorlds/Kastri/blob/82da3db3d0a526f6e93a30f3eb1a6c14779399bb/Features/Connectivity/DW.Connectivity.Android.pas#L98
  5. Dave Nottage

    MacOS AVPlayer and DRM

    It's not correct. It needs to be: keyResponse := TAVContentKeyResponse.Wrap(TAVContentKeyResponse.OCClass.contentKeyResponseWithFairPlayStreamingKeyResponseData(ckcData)); If it's an NSDictionary with only one object, this is an example using a typical pattern for that scenario: dict := TNSDictionary.Wrap(TNSDictionary.OCClass.dictionaryWithObject(TNSNumber.OCClass.numberWithInt(1), NSObjectToID(AVContentKeyRequestProtocolVersionsKey)); When there's more than one value to add, one way is to create an instance of NSMutableDictionary, and use the setValue method. There's a couple of examples in FMX.AddressBook.iOS assetIDData := assetIDString.dataUsingEncoding(NSUTF8StringEncoding);
  6. Dave Nottage

    MacOS AVPlayer and DRM

    Should be: FContentKeySession.addContentKeyRecipient(NSObjectToID(FAsset)) You shouldn't need to use a TTask in the code there, either. I had issues compiling your test project, so I started a new one, and just added the form from the original project to it.
  7. Dave Nottage

    Bug with formatfloat in crossplatform ?

    Well, they're obtained differently, since they're different operating systems. The problem here is either in the call to CFLocaleCopyCurrent or CFLocalGetValue, which is what Delphi currently uses to obtain the decimal separator. The decimalSeparator method of NSLocale gives the correct result.
  8. Dave Nottage

    How to get the actual UTC time??

    You might want to read this:
  9. Do you have a minimal reproducible example?
  10. I have code that requests location permissions at runtime, however of course the user might deny that permission. In case they made a mistake, or change their mind, I want to be able to give the user the opportunity to grant the permission because attempting to request the permission in code will result in the user not being prompted, and the permission being denied. Unfortunately, there does not seem to be an easy way (at least on Android 11) of providing this. The following code will show the Location Permissions settings for the device: var LIntent: JIntent; begin LIntent := TJIntent.JavaClass.init(TJSettings.JavaClass.ACTION_LOCATION_SOURCE_SETTINGS); TAndroidHelper.Activity.startActivityForResult(LIntent, 0); end; However the user then has to - Tap the "App access to location" item: Scroll down to the "Denied" section and tap the app in question: Then select whichever option is appropriate (for this particular app it's "Allow all the time") Then the user needs to either tap the back arrow until the settings screens disappear (Cannot use the app switcher to switch back to the app) This is obviously a horrible user experience. Does anyone know of a better way?
  11. Understood, however there will always be someone, and they may still contact support to ask why the app is not working 😉
  12. As far as I can work out, it's not possible to revoke permissions from within an application, however it is possible external to the device, using adb: https://stackoverflow.com/a/32683390/3164070 I'm not sure what the use case would be for being able to do it from within the app other than for testing purposes, and that's covered by using adb as per the link above.
  13. I've improved the experience somewhat, by opening the App Info screen instead using this code: var LIntent: JIntent; LUri: Jnet_Uri; begin LUri := TJnet_Uri.JavaClass.fromParts(StringToJString('package'), TAndroidHelper.Context.getPackageName, nil); LIntent := TJIntent.JavaClass.init(TJSettings.JavaClass.ACTION_APPLICATION_DETAILS_SETTINGS, LUri); LIntent.addFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK); TAndroidHelper.Context.startActivity(LIntent); end; Then the user only has to: Tap "Permissions" Tap "Location" Select the appropriate option (e.g. "Allow All The Time") Use the app switcher to switch back to the app, or use the back arrow/button 3 times Still not great, but better 🙂
  14. Dave Nottage

    TJSONObject.Format bug

    Tidy is a method of TJson (via a class helper), not TJsonObject. It's also a class method, so you don't need an instance of anything to call it
  15. Dave Nottage

    TJSONObject.Format bug

    I used @Lars Fosdal's code: https://github.com/DelphiWorlds/Kastri/blob/672522381e8fe192f562cdcb95b9f473b08fc0b6/Core/DW.REST.Json.Helpers.pas#L77 Works better than the Format method, for me 🙂
  16. Dave Nottage

    A form in library inside an android application

    I'd be looking at what exactly is contained in that form - perhaps some graphics (in TImage etc) that may be larger than necessary?
  17. Dave Nottage

    Access violation on resume in IOS

    Is debugging from the IDE not working for you?
  18. Dave Nottage

    Android 11 Support in 10.4.2?

    I guess I did not explain it well enough. The value you quoted is not the targetSdkVersion that I mentioned - it is the version of the installed SDK, which has absolutely nothing to do with targetSdkVersion, platform API level, or pretty much any other value that is important to Android development.
  19. Dave Nottage

    Android 11 Support in 10.4.2?

    To clarify: Android 11 is supported. The distinction is in the value for targetSdkVersion that ends up in AndroidManifest.xml (currently, the value is set to 29, as opposed to 30). A targetSdkVersion of 30 is yet to be fully supported, as it requires changes to the support of accessing external storage (and possibly other aspects of API 30). This is what is being referred to with a statement of: They really should make the distinction if they are saying it like that. Also, targeting an API level (via targetSdkVersion) and building against an API level are 2 completely different things, so downloading platform API level 30 and changing the SDK settings to suit is not the same as changing the target.
  20. Sorry, I missed the "additional" part 🙂
  21. Please refer to this part of the answer: i.e. you would need to uncheck all of these: ..and add your own, keeping the same Remote Path and Remote Name values
  22. Dave Nottage

    [Android]How to make an event listener?

    By "events", if you mean things like whether the app became active, entered the background etc, you can have the app subscribe to TApplicationEventMessage: http://docwiki.embarcadero.com/Libraries/Sydney/en/FMX.Platform.TApplicationEventMessage Use TMessageManager to subscribe to the event, e.g: TMessageManager.DefaultManager.SubscribeToMessage(TApplicationEventMessage, ApplicationEventMessageHandler); ..and to unsubscribe when you no longer wish to receive the messages: TMessageManager.DefaultManager.Unsubscribe(TApplicationEventMessage, ApplicationEventMessageHandler); Example handler: procedure TMyClass.ApplicationEventMessageHandler(const Sender: TObject; const M: TMessage); var LMessage: TApplicationEventMessage; begin LMessage := TApplicationEventMessage(M); case LMessage.Value.Event of TApplicationEvent.BecameActive: DoAppBecameActive; TApplicationEvent.EnteredBackground: DoAppEnteredBackground; // etc end; end;
  23. Dave Nottage

    XCode 12 compile error

    Can you indicate what value you have for CFBundleName? See also: https://quality.embarcadero.com/browse/RSP-32150
  24. Dave Nottage

    Rad Studio - Cannot Connect to the Mac

    http://docwiki.embarcadero.com/RADStudio/Sydney/en/Steps_in_Creating_Multi-Device_Applications#If_your_application_targets_either_macOS_or_iOS See steps 5 and 6
×