Jump to content

Dave Nottage

Members
  • Content Count

    1336
  • Joined

  • Last visited

  • Days Won

    29

Posts posted by Dave Nottage


  1. 6 hours ago, KMarb said:

    If I go to shared downloads folder

    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.

    6 hours ago, KMarb said:

    I see people who write log messages somehow/somewhere which I would think would be a great help sometimes to figure what's wrong. Is there an article that talks about setting that up?

    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.

    3 hours ago, KMarb said:

    How do I know if my app has permission to install an apk?

    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.


  2. 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.


  3. 3 hours ago, KMarb said:

    Project JCMTime.apk raised exception class EJNIException with message 'java.lang.IllegalArgumentException: Couldn't find meta-data for provider with authority com.zunna.JCMTime.fileprovider'

    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.


  4. 9 minutes ago, KMarb said:

    Intent.setDataAndType(TJnet_Uri.JavaClass.fromFile(F), StringToJString('application/vnd.android.package-archive'));

    This should be:

        Intent.setDataAndType(JFileToJURI(F)), StringToJString('application/vnd.android.package-archive'));

    JFileToJURI uses the FileProvider class to create the correct URI

    12 minutes ago, KMarb said:

    I've tried adding the below to manifest file:

    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.


  5. 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;

     

    • Like 1

  6. 1 hour ago, Nicolò Blunda said:

    It is possible to adapt code above to get it?

    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'))));

     

     


  7. 8 hours ago, vladvash said:

    I understand that there is something with the folder settings, SDK, NDK, but I don’t understand where and how to look

    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:

    image.thumb.png.d4b1c13d18adba43bf5410782c97a375.png


  8. On 7/11/2022 at 8:54 PM, Alexander Halser said:

    Delphi tells me that when deploying the app, there are ambiguous certificate matches.

    As ginnix suggests, this is because the ambiguous certificates are in the Keychain on your machine. In the Applications/Utilities folder there is an application called Keychain Access. Run that, select the "login" keychain on the left hand side, and select the "My Certificates" tab. Delete all the ambiguous Developer ID certificates except for the one with the latest expiry date, by right-clicking each one and clicking "Delete"


  9. 1 hour ago, Jolubaro said:

    So, with FMX there is not solution for my problem

    There can be solutions; just that there isn't any included with Delphi. This is a potential starting point: https://developer.android.com/training/printing, though you will need knowledge of Java, and how to convert the code to Delphi.

    1 hour ago, Jolubaro said:

    What about other platforms of programming

    If you mean development tools other than Delphi, there could be solutions using those, however it may still require writing the same code as per the link mentioned above, i.e. it would be unlikely to be included with the development tool itself.


  10. 12 hours ago, Andy1234 said:

    But Apple didn't accept it due to SDK 14.
    Only need SDK 15, as I wrote in the first message

    Even if you were to obtain the iOS 15.x SDK, Apple will still reject your app because you're not using Xcode 13, which has been a requirement since April 25th.


  11. Why do you want to revert to an older Xcode when Delphi works with the current version? Also, if your intention is to deploy apps to the App Store, you're going to need Xcode 13 anyway.


  12. 9 hours ago, TurboMagic said:

    Can you got a bit more into details about what work it would need?

    Take a look at the issues towards the bottom of this list: https://github.com/DelphiWorlds/Kastri/issues

    Most are prefixed with [Camera]

    9 hours ago, TurboMagic said:

    Does Camera API 2 have a setting for the exposure time?

    Yes

    9 hours ago, TurboMagic said:

    Have you surfaced that one

    Not as yet

    9 hours ago, TurboMagic said:

    would it be easy to add it?

    It's not trivial, but also not rocket science 🙂

    9 hours ago, TurboMagic said:

    And why, oh why, does Android need so many different takes on a camera API?

    Camera X appears to be just a "convenience" layer over Camera 2, so there's really still only 2 "takes". For "lower level" stuff like controlling exposure they recommend Camera 2, so I may be sticking with that for now anyway.

×