Jump to content

Dave Nottage

Members
  • Content Count

    1332
  • Joined

  • Last visited

  • Days Won

    29

Posts posted by Dave Nottage


  1. Background:

     

    I'm working on an implementation of Geofencing on Android, based on this documentation: https://developer.android.com/training/location/geofencing

     

    ..and based on their example on Github: https://github.com/android/location-samples/tree/master/Geofencing

     

    To be able to help with this, you will likely need some Java skills, and know about Android intents and receivers. I don't know completely everything about them, hence the request for help

     

    Demo:

     

    I've attached the work in progress demo, which should compile as-is, i.e. it should not be dependent on anything - it uses files from Kastri, but I have copied them into the project.

     

    I've also included the source for the Java parts, as a reference. The corresponding binary is dw-geofence.jar, which is included in the Lib folder of the project.

     

    The demo sets up 3 geofence regions. Tapping the Start button first requests location permissions - in order for geofencing to work, you need to tap on "Allow in settings":

    image.thumb.png.180b7f6b7e290efededccf239ea5ce35.png

     

    ..and select the "Allow all the time" option:
    image.thumb.png.fc65ab762bd1868600be75e54c88a0ca.png  

     

    (then tap the back arrow at the top)

     

    If geofence starts successfully, a message will appear in the memo: Action: 1, Result: 0, Message:  (Action of 1 = start monitoring, Result of 0 = success)

     

    Simulating changes in location:

     

    So that you don't actually have to physically move anywhere, fortunately on Android it is possible to simulate location changes by using a "mock gps" app, such as this one: https://play.google.com/store/apps/details?id=org.hola.gpslocation

     

    Once installed, you need to go into the Developer Options of the Settings app on the device, and set the mock locations app:

     

    image.thumb.png.24d47ac3c0c14b4f994b0c2f17de6829.png

     

    Then use the mock locations app to change your location to one of the geofence regions created by the AddRegions method of TMainView in AG.View.Main in the project.

     

    The problem 

     

    I find that when moving into/out of the regions, the GeofenceIntentReceiver is not being "triggered", i.e. onReceive is not being called.

     

    If someone is able to help, it would be greatly appreciated. 

     

     

    AGDemo.zip


  2. I've tried your app on my Samsung tablet which has Android 9, and the results are the same. It works on my Pixel 3a which has Android 11.

     

    Some questions:

     

    Was the application created in an earlier version of Delphi? i.e. like Delphi 10.3.x, or earlier?

     

    Does the Libraries node under the Android platform in Project Manager look different to this?:

     

    image.thumb.png.703ae82cb377ee158446e39eb88f7514.png

     

    Are there any Java classes that your app uses that you needed to create (or find) an import for? i.e. one that was not supplied with Delphi? If so, which one(s)?


  3. 1 hour ago, Renate Schaaf said:

    My problem is, that this offers way too many browsers for the user to choose from, when all that really works is browsing MyDocuments.

    By "browsers" I assume you mean "folders"? What does "MyDocuments" actually represent? Does it mean the files contained in the folder returned by TPath.GetDocumentsPath? If so, is there some reason why you cannot iterate the files in that folder, and just present them in a list box?


  4. 6 hours ago, Massimiliano S said:

    At Xamarin I know that all these obstacles have overcome them

    You mean it's possible to use an extension of the type you're using in a Xamarin project? Can you find out what their build process does?

     

    I'd like to be able to help you solve this. Can you confirm that the extension you created is exactly the one I asked about earlier? i.e.

     

    image.png.c76dff94ace6aec32b9261b9a64d3ad0.png


  5. 18 hours ago, Martifan said:

    Thank you very much in advance

    then I'll wait 🙂 and if you can add round buttons

    Has not been successful so far. The initWithAuthorizationButtonType method seems to ignore the 2nd parameter being passed to it, as well as the setCornerRadius method. Very odd


  6. 49 minutes ago, Martifan said:

    Ok, thanks, I just wanted a more round button to do.

    How do I change the color of buttons and text on a button? what style is on the phone?

    Ah yes, sorry.. the roundness can be changed. I'll take a look at adding that. These are the style values:

     

      ASAuthorizationAppleIDButtonStyleBlack

      A black button.

     

      ASAuthorizationAppleIDButtonStyleWhiteOutline

      A button with a white outline.

     

      ASAuthorizationAppleIDButtonStyleWhite

     

    Which are displayed in the link I gave:

     

      https://developer.apple.com/design/human-interface-guidelines/sign-in-with-apple/overview/buttons/#creating-a-custom-sign-in-with-apple-button

     

    I'll also take a look at adding support for those.


  7. 59 minutes ago, Martifan said:

    I want to change the style of the button or use another button with more effects

    The implementation I have done uses the native control, i.e. ASAuthorizationAppleIDButton, which is fairly limited in the styles available. Please refer to:

     

      https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidbutton?language=objc

      https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidbuttonstyle?language=objc

     

    If you have a sign-in button which does not have a style that is mandated by Apple, your app is likely to be rejected. See:

     

      https://developer.apple.com/design/human-interface-guidelines/sign-in-with-apple/overview/buttons/#creating-a-custom-sign-in-with-apple-button

     

    Examples of rejections:

     

      https://community.auth0.com/t/apple-store-rejected-app-because-of-sign-in-with-apple-styles/43854

      https://github.com/firebase/FirebaseUI-iOS/issues/823

     

    For these reasons, I'm not going to be implementing styles other than what they provide.

     

     


  8. On 7/17/2020 at 6:45 AM, Massimiliano S said:

    [PAClient Error] Error: E0776 error: exportArchive: No 'teamID' specified and no team ID found in the archive

    For anyone that might come across this topic: I had this error recently. It was being caused by the less than optimal Version Info grid in Project Options. Somehow the CFBundleExecutable value was changed:

     

    image.thumb.png.5b2fab70bbcf3968a27d8a3b1da2d3c2.png

     

    So if you have the same error message, it might pay to check the values in the Version Info section


  9. I figured this would be easy..

     

    I'm working on an app that needs to read data from a com port - this I have code for. I'm having trouble finding something (that actually works), that can "simulate" data being sent to the port so that it can be read from the app. Simulation is needed because I'm remoting to the machine in question and I'd rather avoid having to (or for someone else to) go to where the machine is to connect a device that might not even be suitable. 

     

    I have come across this: https://www.aggsoft.com/com-port-emulator.htm, however I'm unable to work out exactly how it is supposed to emulate (when clicking "Start", it prevents anything else from accessing the port) or it's just not suitable anyway.

     

    I used to work on apps over 20 years ago (using Delphi 3) that did this kind of thing, but we had the luxury of having the actual hardware with us. That's about how long it has been since I've done this kind of thing.

     

     


  10. 4 hours ago, OmarPerezH said:

    Best way, 1- Export SDK from Delphi IDE Tools->Options->SDK Manager select SDK and export and import it in the new Delphi IDE

    That the export option exists had slipped my mind.. I'll update my article; thanks!


  11. 7 hours ago, Bert-Jan said:

    I upgraded Xcode to 12, my iPhone to iOS 14

    You'll find you won't be able to debug with a device that has iOS 14.0. Deploying will work; just not debugging.

    7 hours ago, Bert-Jan said:

    Going back to SDK 13.6 does not help so I guess this has to do with Xcode.

    Because Delphi does not import the iOS 13.6 SDK correctly, either (as well as iOS 14.0). Use iOS 13.5 SDK if you can - it comes with Xcode 11.5. I wrote about it here:

     

    https://delphiworlds.com/2020/08/using-a-prior-ios-or-macos-sdk-with-delphi/

×