Jump to content

Dave Nottage

Members
  • Content Count

    1331
  • Joined

  • Last visited

  • Days Won

    29

Posts posted by Dave Nottage


  1. On iOS, the first location change has values of 0 for OldLocation.Latitude and OldLocation.Longitude. On Android, they're both NaN, so your code will fail in that case. You should do this check (at least):

        if not IsNan(Latitude1) and not IsNan(Longitude1) then


     

    • Thanks 1

  2. 35 minutes ago, Darian Miller said:

    You should be able to fix spelling mistakes of public methods from a recently published version

    More a case of: a major release is the best time to do it, since it can be interface breaking.

     

    If, after the change, a users code does not compile, I doubt they're going to say: "I want it back with the incorrect spelling". They're more likely to say: "I'm upset that you spelled it wrong in the first place, but fixing it is way better".

    • Like 1

  3. 3 hours ago, BobTheBuilder said:

    What Dave Nottage excludes completely is the fact that during creation the AndroidManifest.xml is copied to AndroidManifest.template.xml in your source directory.

    You're misrepresenting my reply. It is exactly why I said to examine that file.

     

    3 hours ago, BobTheBuilder said:

    So changing the AndroidManifest.xml in your AppData folder has zero effect

    It certainly does have an effect when creating new projects.


  4. 50 minutes ago, Aamgian said:

    now I have not found a reference for iOS.

    That's because you cannot retrieve existing SMS messages on iOS - this is a privacy restriction from Apple. You cannot even intercept new messages.


  5. Check this link: https://forums.embarcadero.com/thread.jspa?threadID=256233

     

    This is a link to the demo I created: https://forums.embarcadero.com/thread.jspa?messageID=899142

     

    Edit: Just realised you want it for 10.3.3. That old demo might still work, though. If not, I'll help modify it

     

    Edit 2: Also now realised you want existing messages. Probably better to use the conversations class: https://developer.android.com/reference/android/provider/Telephony.Sms.Conversations. If the code on FMX Express does not work, please indicate what errors you're having. It may be that you just need to request the READ_SMS permission.

    • Thanks 1

  6. JNI.rar did not include the compiled .jar file, nor did the project have .jar file added to libraries.

     

    I updated the project to Delphi 10.3.3, compiled the UseAsJar.java file into UseAsJar.jar, added it to the project, zipped it and attached it to this reply. The project now works OK here.

     

    You can "downgrade" the project to whatever version of Delphi you're using by right-clicking the "Libraries" node and click "Revert System Files to Default"

    prjJNITest.zip


  7. 2 hours ago, Hans♫ said:

    On Firemonkey there is a problem loading fonts dynamically, so maybe its related to that?

    I think you may be right.

    1 hour ago, Anders Melander said:

    Have you tried installing the fonts manually on these machines?

    No, since the goal is to not have them installed. Having said that, I have a bad feeling that the machines on which it does work may have the font already installed (not sure if anyone actually checked), especially given Hans' answer. I'll know for sure tomorrow.


  8. Some code I'm working with uses AddFontResource or AddFontResourceEx - both return a positive value (in this case 1), so according to the documentation the font is added successfully, however they are not actually displaying correctly.

     

    The problem happens only on certain machines, in this case Getac Windows Tablet (F110 and T800 models), but the fonts are displayed correctly using the same application on a Microsoft Surface. All machines are using an administrator user account. 

     

    Any ideas as to why it does not work on the machines in question?


  9. 1. You don't need to add the classes.dex file to the project, nor the .java files

    2. The UseAsJar.java file is missing the package directive which by convention is a domain in reverse order followed by a package identifier, e.g. com.mydomain.mypackage. Also, you do not need a main method, unless you're intending to run the jar separately.

    3. Your import (android.JNI.UseAsJAR) is incorrect, since the signature for JUseAsJar does not match the package/class. It should be the package name followed by the class name e.g. com/mydomain/mypackage/UseAsJar. You don't need RegisterTypes, either; I believe that's a hangover from earlier versions of Delphi.

    4. Once you've recompiled the .jar, add it to the project, in Project Manager under Target Platforms > Android. This saves having to manually deploy the classes.dex. You could then remove that manual addition.

     

    I'd also recommend updating to Delphi 10.3.3

    • Like 1

  10. 53 minutes ago, Rollo62 said:

    I'm not dealing with MAcos yet, but did you has provisioning file update recently ?

    I expect you mean certificate update? Recently as in a couple of months ago, yes, however I removed the old ones.

    55 minutes ago, Rollo62 said:

    Most of the time, the Options\Provisioning page shows wrong information

    The provisioning page for macOS is very different from iOS - you need to manually type in the developer certificate name (and installer certificate name if one applies), and cannot even select a provisioning profile.


  11. Anyone here successfully deployed a macOS App Store application? I've followed the instructions here:


       http://docwiki.embarcadero.com/RADStudio/Rio/en/Completing_the_Provisioning_Page


    ..have a correct provisioning profile on my Mac, and have set CFBundleIdentifier to the correct value, however Delphi complains:

    [Error Error] Missing provisioning information. Mobile Provisioning Profile has not been specified for the "AppStore" platform configuration.

    Any ideas as to what I should check?


  12. 10 hours ago, vfbb said:

    the handling of incoming url of a universal link is different

    Yes, the application delegate needs to implement this method:

     

    https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623072-application?language=objc

     

    This means class_addmethod will need to be called to add it to the delegate (DelphiAppDelegate). It will also need an import for NSUserActivity, one of which follows (no guarantees as to being 100% accurate):

      NSUserActivityPersistentIdentifier = NSString;
    
      TNSUserActivityBlockMethod1 = procedure(inputStream: NSInputStream; outputStream: NSOutputStream; error: NSError) of object;
      TNSUserActivityBlockMethod2 = procedure of object;
    
      NSUserActivityClass = interface(NSObjectClass)
        ['{412EAEBF-5927-4D01-B83F-69D3B5DFE7B5}']
        {class} procedure deleteAllSavedUserActivitiesWithCompletionHandler(handler: TNSUserActivityBlockMethod2); cdecl;
        [MethodName('deleteSavedUserActivitiesWithPersistentIdentifiers:completionHandler:')]
        {class} procedure deleteSavedUserActivitiesWithPersistentIdentifiers(persistentIdentifiers: NSArray; handler: TNSUserActivityBlockMethod2); cdecl;
      end;
    
      NSUserActivity = interface(NSObject)
        ['{B8C2F6C9-31FE-4282-B7CA-98C96E163033}']
        function activityType: NSString; cdecl;
        procedure addUserInfoEntriesFromDictionary(otherDictionary: NSDictionary); cdecl;
        procedure becomeCurrent; cdecl;
        function delegate: Pointer; cdecl;
        function expirationDate: NSDate; cdecl;
        procedure getContinuationStreamsWithCompletionHandler(completionHandler: TNSUserActivityBlockMethod1); cdecl;
        function initWithActivityType(activityType: NSString): Pointer; cdecl;
        procedure invalidate; cdecl;
        function isEligibleForHandoff: Boolean; cdecl;
        function isEligibleForPrediction: Boolean; cdecl;
        function isEligibleForPublicIndexing: Boolean; cdecl;
        function isEligibleForSearch: Boolean; cdecl;
        function keywords: NSSet; cdecl;
        function needsSave: Boolean; cdecl;
        function persistentIdentifier: NSUserActivityPersistentIdentifier; cdecl;
        function referrerURL: NSURL; cdecl;
        function requiredUserInfoKeys: NSSet; cdecl;
        procedure resignCurrent; cdecl;
        procedure setDelegate(delegate: Pointer); cdecl;
        procedure setEligibleForHandoff(eligibleForHandoff: Boolean); cdecl;
        procedure setEligibleForPrediction(eligibleForPrediction: Boolean); cdecl;
        procedure setEligibleForPublicIndexing(eligibleForPublicIndexing: Boolean); cdecl;
        procedure setEligibleForSearch(eligibleForSearch: Boolean); cdecl;
        procedure setExpirationDate(expirationDate: NSDate); cdecl;
        procedure setKeywords(keywords: NSSet); cdecl;
        procedure setNeedsSave(needsSave: Boolean); cdecl;
        procedure setPersistentIdentifier(persistentIdentifier: NSUserActivityPersistentIdentifier); cdecl;
        procedure setReferrerURL(referrerURL: NSURL); cdecl;
        procedure setRequiredUserInfoKeys(requiredUserInfoKeys: NSSet); cdecl;
        procedure setSupportsContinuationStreams(supportsContinuationStreams: Boolean); cdecl;
        procedure setTargetContentIdentifier(targetContentIdentifier: NSString); cdecl;
        procedure setTitle(title: NSString); cdecl;
        procedure setUserInfo(userInfo: NSDictionary); cdecl;
        procedure setWebpageURL(webpageURL: NSURL); cdecl;
        function supportsContinuationStreams: Boolean; cdecl;
        function targetContentIdentifier: NSString; cdecl;
        function title: NSString; cdecl;
        function userInfo: NSDictionary; cdecl;
        function webpageURL: NSURL; cdecl;
      end;
      TNSUserActivity = class(TOCGenericImport<NSUserActivityClass, NSUserActivity>) end;

    The method implementation should probably be (again no guarantees):

    class function TApplicationDelegate.applicationContinueUserActivityRestorationHandler(self: id; _cmd: SEL; application: PUIApplication;
      userActivity: Pointer; restorationHandler: Pointer): Boolean;

    As far as I know, it doesn't necessarily have to be patched in FMX.Platform.iOS since you should be able to call class_addmethod anywhere, as long as you pass it the correct class function.

     

    Hopefully this will give you head start.

    • Like 2
    • Thanks 1
×