Jump to content

Dave Nottage

Members
  • Content Count

    1296
  • Joined

  • Last visited

  • Days Won

    29

Everything posted by Dave Nottage

  1. Dave Nottage

    Execute external program/command and capture output

    I don't have any concrete examples as yet, however there is this: https://github.com/DelphiWorlds/Kastri/blob/master/Core/DW.RunProcess.Mac.pas
  2. Dave Nottage

    Android API31 Rad 11.1

    About 4 weeks ago I submitted an update to an app for review on Google Play Store and it took 4 days. After 2 days I queried the delay (which was unusual because the previous updates were available within hours) and they replied that such delays occur from time to time.
  3. Dave Nottage

    Android API31 Rad 11.1

    Exactly. There should be an option in the Version Info to override what the IDE defaults to (currently 30). I've now added this report to the Quality Portal: https://quality.embarcadero.com/browse/RSP-38976
  4. I'd like to be able to remove a dependency on OpenSSL, which is being used in this routine (original context here😞 class function TgoSSLHelper.Sign_RSASHA256(const AData: TBytes; const APrivateKey: TBytes; out ASignature: TBytes): Boolean; var BIOPrivateKey: PBIO; PrivateKey: PEVP_PKEY; Ctx: PEVP_MD_CTX; SHA256: PEVP_MD; Size: Cardinal; begin BIOPrivateKey := BIO_new_mem_buf(@APrivateKey[0], Length(APrivateKey)); PrivateKey := PEM_read_bio_PrivateKey(BIOPrivateKey, nil, nil, nil); Ctx := EVP_MD_CTX_create; try SHA256 := EVP_sha256; if (EVP_DigestSignInit(Ctx, nil, SHA256, nil, PrivateKey) > 0) and (EVP_DigestUpdate(Ctx, @AData[0], Length(AData)) > 0) and (EVP_DigestSignFinal(Ctx, nil, Size) > 0) then begin SetLength(ASignature, Size); Result := EVP_DigestSignFinal(Ctx, @ASignature[0], Size) > 0; end else Result := False; finally EVP_MD_CTX_destroy(Ctx); end; end; I'm a bit green when it comes to cryptography routines, so I'm not exactly sure what it is doing, and the OpenSSL docs are quite verbose, however my goal is to be able to use another library like LockBox, or DCPCrypt (if it can handle it) so as to remove the dependency on OpenSSL. Can someone help replicate it using LockBox3 or perhaps some other (non-commercial) library, or at least point to which classes should be used?
  5. Thanks, however I'm after something that is cross-platform.
  6. Dave Nottage

    Android API31 Rad 11.1

    The message would be that you need to target API level 31 or more. As pcplayer99 inferred, you will need to modify your AndroidManifest.template.xml, by replacing %targetSdkVersion% with the value: 31. You will also need to add an android:exported="true" attribute to the application node in the same file, so that it looks like this: <activity android:name="com.embarcadero.firemonkey.FMXNativeActivity" android:label="%activityLabel%" android:configChanges="orientation|keyboard|keyboardHidden|screenSize" android:exported="true" android:launchMode="singleTask"> If you changed your SDK settings in Delphi SDK Manager to use API level 31, you should change them back to API level 30 unless you want to be stuck with other problems in the manifest (when compiling the app)
  7. Dave Nottage

    Run a form on application exit??

    Use OnCloseQuery in the main form, and prevent the main form from closing unless the "exit" form has already been shown. If it hasn't been shown, show it 🙂
  8. You cannot use FMX.xxx units in an Android service built with Delphi. See: https://quality.embarcadero.com/browse/RSP-17857
  9. Some devices have 64-bit CPUs, but have Android 32-bit running on them. Easiest way to find out if this is the case for you is to download an app like this. On the CPU page it reports whether the device is running in 32-bit mode.
  10. Fair enough - I'd first try 2 instances of Delphi as SwiftExpat has suggested (have you tried this?), otherwise if that's too problematic: the second instance running in a Virtual Machine.
  11. More to it than that: Updating the label (or anything UI related) needs to happen in the main thread - see Rollo62's answer
  12. Dave Nottage

    Multiplatform Hello World error [PAClient Error] Error: E7688

    Looks like you may be using a project created with an older version of Delphi. Please refer to: https://github.com/DelphiWorlds/HowTo/tree/main/Solutions/AndroidLibraries
  13. I'd expect that behaviour if CopyData was running in a separate thread. It would not normally be an issue, otherwise.
  14. I doubt it is possible with one instance of Delphi. Might be better to explain why you need it - there may be an alternative.
  15. Dave Nottage

    Keeping edit field in view when on-screen keyboard appears

    There's this (outdated) article. The demo has moved to here, and it sorely needs another revisit 🙂
  16. Dave Nottage

    Gradle support for Android

    Your repo violates copyright, by including a near copy of System.Zip (apparently from an earlier version of Delphi)
  17. Dave Nottage

    Self-updating android app in Alexandria

    Is there any reason why you can't download to an app-specific folder? There are a number of changes in Android 11 that make it difficult to manage storage in shared folders: https://developer.android.com/about/versions/11/privacy/storage Which would explain why you are having issues. If you're logging from an app, the easiest way is to use Log.d from the FMX.Types unit. You can view the log messages using a logcat viewer - I have one called Device Lens. In Delphi, there's a permission in the Uses Permissions > Signature section of the Project Options called "Request install packages". Even with that checked, the OS might request approval from the user.
  18. Dave Nottage

    Self-updating android app in Alexandria

    This is a complete routine that should work: procedure OpenApplication(const AFileName: string); var LMimeType: JString; LIntent: JIntent; begin LMimeType := TJMimeTypeMap.JavaClass.getSingleton.getMimeTypeFromExtension(StringToJString('apk')); LIntent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_VIEW); LIntent.setDataAndType(JFileToJURI(TJFile.JavaClass.init(StringToJString(AFileName))), LMimeType); LIntent.setFlags(TJIntent.JavaClass.FLAG_GRANT_READ_URI_PERMISSION); TAndroidHelper.Activity.startActivityForResult(LIntent, 999); // 999 is just a random value - it won't matter what it is end; Note the extra line regarding FLAG_GRANT_READ_URI_PERMISSION.
  19. Dave Nottage

    Self-updating android app in Alexandria

    Sorry.. missed a step. Delete AndroidManifest.template.xml in the project folder. The IDE will recreate this. If you have made any customisations to it, you will need to ensure you reinstate those after it is recreated.
  20. Dave Nottage

    Self-updating android app in Alexandria

    This should be: Intent.setDataAndType(JFileToJURI(F)), StringToJString('application/vnd.android.package-archive')); JFileToJURI uses the FileProvider class to create the correct URI You won't need to do that if you check the Secure File Sharing option in the Entitlements List in the Project Options. This also creates and deploys the required xml file.
  21. Dave Nottage

    Components4developers???

    Their blog site appears to be still alive: https://components4developers.blog ..and Kim is still posting on Twitter (at least less than 2 weeks ago): https://twitter.com/comp4dev
  22. Dave Nottage

    Delphi 10.4.2 won't open a specific .PAS file

    How big is the file? It might have some odd characters in it that the IDE cannot handle? Or maybe some peculiar structure? For the characters problem: try loading it in Notepad, make a minor change, then save it, then load it in Delphi again.
  23. Dave Nottage

    [Android] App does not answer anymore

    You do not indicate what library you are using. Is it this one (or similar)? https://github.com/jimmckeeth/FireMonkey-Android-Voice Where you have "impossible to do something", you do not indicate exactly what it is your code is doing. Nor do you show what it is doing in the timer handler. Given that code executes, it's quite possible that the SpeechRecognition1Recognition event is executing outside of the main thread, which may account for the other issues you are seeing. If that is the case, you could use a construct like this: procedure TForm1.SpeechRecognition1Recognition(Sender: TObject; Guess: string); begin TThread.Synchronize(nil, procedure begin G_Heard := Guess; // Execute your other code, here end ); end;
  24. Dave Nottage

    Get copyright info from code in macOS

    It seems it is not included by default in macOS apps produced by Delphi. When it is included, you could use the following code: Value := NSStrToStr(TNSString.Wrap(CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle, StringToID('NSHumanReadableCopyright'))));
  25. It looks like a JDK compatibility issue. Start with showing what your Java settings are in Delphi, i.e. Tools | Options, Deployment > SDK Manager, select the relevant Android SDK, and select the Java tab. Mine looks like this:
×