Jump to content

Dave Nottage

Members
  • Content Count

    1298
  • Joined

  • Last visited

  • Days Won

    29

Posts posted by Dave Nottage


  1. This works for 10.3.x if you have some kind of PDF viewer installed on the device:

    uses
      Androidapi.JNI.GraphicsContentViewText, Androidapi.Helpers, Androidapi.JNI.Net;
      
    procedure OpenPDF(const AFileName: string);
    var
      LIntent: JIntent;
      LUri: Jnet_Uri;
    begin
      LUri := TAndroidHelper.JFileToJURI(TJFile.JavaClass.init(StringToJString(AFileName)));
      LIntent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_VIEW);
      LIntent.setDataAndType(LUri, StringToJString('application/pdf'));
      LIntent.setFlags(TJIntent.JavaClass.FLAG_GRANT_READ_URI_PERMISSION);
      TAndroidHelper.Activity.startActivity(LIntent);
    end;

     

    • Like 1
    • Thanks 2

  2. 12 hours ago, Rollo62 said:

    So do you mean here to use location updates to keep BLE alive in background ?

    No, I was specifically referring to Beacons. I expect the BLE issue is separate.

     

    12 hours ago, Rollo62 said:

    A better solution would be to use " bluetooth-central" only, in background mode, hopefully w/o any side effects.
    But this I didn'T get to work w/o the " bluetooth-peripheral" flag.

    Now I'm confused: does it work, and if so, only with both?


  3. 3 hours ago, Rollo62 said:

    Thanks for sharing, did you also get it working with the mobile frameworks ?

    I haven't had the need to, however I might take a look at it

     

    1 hour ago, baeckerg said:

    Would you share all your enhancements or do you host it somewhere?

    I'll work on sharing the parts that I can share.


  4. 3 hours ago, Rollo62 said:

    Well, is that line of yours an advertisement for BeaconFence ?

    I don't understand how you came to that conclusion.

     

    3 hours ago, Rollo62 said:

    Why else did Embarcadero added them ?

    As far as I know, they haven't

     

    3 hours ago, Rollo62 said:

    Is there any way to get background modes working as expected?

    Yes, with the changes I proposed in the QP report.


  5. A while ago I was looking for something that's cross-platform (Windows and macOS) so decided to check out CE4. For me, it was extremely difficult to work with, if the goal is to use it for automation.

     

    I ended up using TWebBrowser in FMX and wrote a bunch of helper methods for both platforms, one of the most critical being:

    // macOS
    class function THTMLHelper.GetBrowserDocument(const ABrowser: TObject): DOMDocument;
    var
      LWebView: WebView;
    begin
      Result := nil;
      if Supports(ABrowser, WebView, LWebView) then
        Result := LWebView.mainFrame.DOMDocument;
    end;
    
    // Windows
    class function THTMLHelper.GetBrowserDocument(const ABrowser: TObject): IHTMLDocument3;
    var
      LBrowser: IWebBrowser;
    begin
      if Supports(ABrowser, IWebBrowser, LBrowser) then
        Supports(LBrowser.Document, IHTMLDocument3, Result);
    end;

     

    • Like 1
    • Thanks 1

  6. Works OK here. My steps:

     

    1. Create a blank FMX app, change platform to OSX 64-bit

    2. Add a button and memo

    3. Add the code you described

    4. Save the project

    5. Open FMX.Memo.pas from the source, and save it in the same folder as the project

    6. Put a breakpoint in TCustomMemo.GetText

    7. Close the file in the editor

    8. Run the app with debugging

    9. Click the button.

    IDE opens the local copy, as expected, and stops at the expected breakpoint

     

    • Thanks 1

  7. 2 hours ago, Rollo62 said:

      ld: warning: directory not found for option '-L\ComponentHelpers'
      ld: warning: directory not found for option '-L\Controls'
      ld: warning: directory not found for option '-L\Core'
      ld: warning: directory not found for option '-L\Features\Firebase'
      ld: warning: directory not found for option '-L\Features\NFC'
      ld: warning: directory not found for option '-L\Src\Features\Notifications'

    Those paths look suspiciously like mine in Kastri Free. What exactly are you compiling?

    2 hours ago, Rollo62 said:

    ld: file not found: kernel32.dll

    I suggest checking whether you have a unit that references the DLL without having a conditional define, or that the path to it is included for macOS when it should not be


  8. If you are using Delphi 10.3, for this situation you do not need to modify AndroidManifest.template.xml yourself. Unless you have other customizations to it, please delete it (or remove your <provider> changes). 

     

    Go to the Project Options, select Application > Entitlement List and check the Secure File Sharing checkbox.


  9. 13 hours ago, pcplayer99 said:

    So, check this procedure in System.Permissions, there is no code to call AOnDisplayRationale.

    You need to trace through the TAndroidPermissionsService.InternalRequestPermissions method in the System.Android.Permissions unit. Note that the rationale is shown only when permissions are not granted by the user.


  10. 40 minutes ago, Mike Torrettinni said:

    FindComponent('CustomButton'), but I don't like it since it doesn't validate names

     

    40 minutes ago, Mike Torrettinni said:

    will still give me some way to verify I don't misspell the names

     FindComponent returns nil if you misspell the name, so just check for nil?
     


  11. 3 hours ago, rvk said:

    You say "RDS" DLL. How is that DLL different?

    The difference is it is loaded by RDS.

     

    3 hours ago, rvk said:

    Could you share the code?

    I could put together code that just replicates the problem, if you're able to help with it


  12. On 7/19/2019 at 12:11 AM, rvk said:

    The handle (hNative) is a TW_UINT32 (which is a Cardinal/32bit). I wonder if it shouldn't be a TW_Handle (which should be a NativeUInt and UInt64 on 64 bit). At least GlobalLock expects a THandle (which is UInt64 on 64 bit).

    You're right, it should be, and I changed it to THandle (same as used by GlobalLock) for hNative in the TransferImages method, and the Handle parameter in the ReadNative method, but to no avail - same problem.

     

    On 7/19/2019 at 12:11 AM, rvk said:

    Strange this worked locally on the machine itself but fails on RDP. Maybe the handle-numbers are much larger and it fails.

    The handle numbers are larger, e.g:

    In the "standalone" DLL:   57278728 (36A0108)
    In the "RDS" DLL: 2333671976  (8B190228) and 1541866024 (5BE70228)

     

×