Jump to content

Dave Nottage

Members
  • Content Count

    1337
  • Joined

  • Last visited

  • Days Won

    29

Posts posted by Dave Nottage


  1. Just now, grantful said:

    May i ask what pointed you in the right direction ?

    It's a common issue. Also, I implemented something similar before it was added to Delphi.

    1 minute ago, grantful said:

    I am trying to learn how to debug these problems.

    Using Google can help, although with this particular issue it's not entirely obvious what is the easiest way to resolve it. Here, Delphi is doing the work for you, by creating a provider_paths.xml file and including it in the deployment.


  2. 4 minutes ago, toufik said:

    i don't know what I'm missing i keep thinking that the new library is the problem (because its come with new change to how to implement purchase) 

    It's supposed to be backward compatible. You should use the OnError event of InAppPurchase1 to find out what the failure is.

     

    • Like 1

  3. 1 hour ago, Alin said:

    1. they have at most 20 members (perhaps they are only targeted for groups of devices belonging to the same user / person)

    " The maximum number of members allowed for a notification key is 20. "

     

    2. they are accessible only through the old (legacy) HTTP protocol, which is severely discouraged or even disabled for new projects

    " You can use device group messaging via the legacy XMPP or HTTP protocols on your app server. "

    I missed that part, thanks. I was focusing more on how it might be implemented.

    1 hour ago, Alin said:

    Did I understand this correctly?

    It seems that way.

    On 5/5/2023 at 9:06 PM, Alin said:

    I need to be able to send notifications to some of them at any moment, for example 1,500 now and 2,000 in an hour

    Given that, you'd need to code your server to be able to handle sending a message every second or so. Since sending the message seems to sometimes take more than a second, you'd need to spawn a thread or two (or three) to do the work.


  4. 4 hours ago, TheTired said:

    "No SDKS could be found for the macOS 64-bit platform. Did you install the Command Line Tools on your XCode?"

    That message should probably also recommend executing this command from a terminal window on the Mac:

    xcode-select -p

    If you're using the default install of Xcode, it should output:

    /Applications/Xcode.app/Contents/Developer

    If it doesn't, use this command:

    xcode-select --switch /Applications/Xcode.app/Contents/Developer

     


  5. 8 hours ago, Dave Nottage said:

    To support subscriptions (which apparently are new in v5), or something else?

    I've since seen your reply on Facebook, which indicates you're interested in the new features. I'll take a look into what changes might be possible, however it would be at least later in the week.


  6. 10 hours ago, Alin said:

    I can pick at any given time 2,500 random recipients and send the e-mail or the snail-mail to them if necessary, depending on criteria that can be anything. But those administrators above decide, and they don't group users into groups or topics, it's about very different criteria. How can I do the same for these FCM notifications?

    In this instance topics won't help, since the topic needs to be subscribed to from the client side.

    10 hours ago, Alin said:

    Or could I create a topic and subscribe the users to it from the server side, then send the message to that topic, and then dissolve it?

    As above, topics are subscribed to from the client side, so for your case you would need to implement message groups, as per the link I posted in my previous reply. As long as you have the tokens, you can select some at random, send a request to FCM for a notification key that includes all the selected tokens, then send a message using that key.


  7. 10 hours ago, DonSa said:

    But in Firemonkey iOS, there is error at line: "FJavaScriptValueCallback := TJavaScriptValueCallback.Create;" with message: Incompatibe types TJavaScriptValueCallback  and TWKScriptMessage

    As per the documentation, you do not create an instance of WKScriptMessage, and in any event, you cannot descend from TWKScriptMessage anyway. Also as per the documentation it is used when you implement custom Javascript message handlers. 

     

    What you could do is use the evaluateJavaScript method of WKWebView and pass to it a completion handler, which could be declared on your main form like this:

    procedure JavaScriptCompletionHandler(obj: Pointer; error: NSError);

    ..and implement it like this:

    procedure TfrmMain.JavaScriptCompletionHandler(obj: Pointer; error: NSError);
    var
      LJavaScriptResult: string;
      LCode: Integer;
    begin
      if obj <> nil then
        LJavaScriptResult := NSStrToStr(TNSString.Wrap(obj))
      else
        LJavaScriptResult := 'null';
      if error = nil then
        LCode := 0
      else
        LCode := error.code;
      // Do something with LJavaScriptResult and LCode, here
    end;

    Call evaluateJavascript like this:

    LWebView.evaluateJavaScript(StrToNSStr(AJavaScript), JavaScriptCompletionHandler)

    Where LWebView is a reference to the WKWebView in the iOS implementation of TWebBrowser

    • Like 1

  8. 6 hours ago, Alin said:

    First I want to .honestly. congratulate and thank Dave Nottage and all his collaborators for the great work which is the Kastri Library

    Thanks!

    6 hours ago, Alin said:

    I want to somehow feed FCM a list of 500 tokens so it could send the message to all of them.

    It's much easier to have each of the devices subscribe to a topic using the SubscribeToTopic method, and simply send the push notification using a topic, rather than multiple tokens.

    6 hours ago, Alin said:

    How should one implement this?

    If you really do want to base it on individual tokens, see:
     

      https://firebase.google.com/docs/cloud-messaging/js/device-group


    It's in Javascript, however something similar could be constructed in Delphi.

    • Like 1

  9. 23 minutes ago, Fraser said:

    I have tried to install the newly available community edition which is 11.0.

    The community edition is 11.3, not 11.0

    24 minutes ago, Fraser said:

    Has someone made a complete mess of things?  My e-mail with the serial number gives a link to an installation program for 11.3 : RADStudio_11_3_esd_28_13236.exe

    That's because the version number is 11.3. Please consider changing the topic of your post - it is completely misleading


  10. 14 hours ago, AlanScottAgain said:

    The reminders will need to be active after a reboot and work on both Android and iPhone.

    On Android, for notifications to still work after a reboot, you would need to persist them in some way, and recreate them, *and* have the app start at boot. I have an example of how to have an app that starts at boot, here:

      https://github.com/DelphiWorlds/Kastri/tree/master/Demos/AndroidStartAtBoot

     

    This is a demo from Embarcadero of how to create/send notifications:

      https://github.com/Embarcadero/RADStudio11Demos/tree/main/Object Pascal/Mobile Snippets/Notifications/SendCancelNotification

     

    As discussed above, if you want to recreate the notification at device start you would also need to persist them somehow, e.g. using a database, or perhaps as JSON, read the data and recreate the notifications when the app starts. You would need to handle when a notification is received, so that you remove it from the persisted notifications.

     

    On iOS, as far as I know you are out of luck regarding recreating notifications at device start - there does not appear to be anyway for an app to handle this, without the user starting the app.

     

     

×