0

I am currently working on an Android Application developed in Delphi 10.2 and have most of the functionality that I need working. However I am trying to get my head around the following SharedActivity.getContentResolver.registerContentObserver. I what to use this for detecting when an SMS has been sent via content://sms/sent URI.

I have the code that will go and get the message using sharedactivity.getcontentresolver.query but just struggling with the ContentObserver part in Delphi. Have spent 2 days searching for an example but found nothing. Maybe it is not possible!

obl
  • 1,799
  • 12
  • 38
  • Welcome to SO! Please post some code as to what you have tried so far so others can better assist you. – obl Feb 14 '19 at 22:03
  • It's not possible to do it without writing some Java code, namely to create a descendant of ContentObserver and a companion interface to use as a "listener". There's an example in the source supplied with Delphi, in the Java source in the rtl\androiddex\java\fmx\src\com\embarcadero\firemonkey\addressbook folder, and they are consumed in the Delphi code in fmx\FMX.AddressBook.Android.pas. If I had time, I'd put together a more complete answer – Dave Nottage Feb 15 '19 at 07:13
  • Dave many thanks for this pointer I have taken a look and can start to see how it is being achieved in their example. What I don't entirely understand, which is due to my lack of knowledge, is the Java bit. Looking at their files I cannot see how the Java bit is referenced by Delphi. Please note my knowledge of Java is very limited. You mentioned that the Java is consumed by delphi but I don't see or understand this part. I took a look at http://www.pacifier.com/~mmead/borland/borcon2001/index.html#CallingJava but not sure if that is that starting point. – RichardC Feb 15 '19 at 10:31
  • Perhaps there is a better way of detecting when an SMS has been sent from Delphi? But I also want to get my head around ContentObserver challenge now. Many Thanks again. – RichardC Feb 15 '19 at 10:31

0 Answers0