Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intercept received SMS in Delphi XE5 for Android

Is it possible to intercept received SMS from Android in Delphi XE5 as per this java code How to read the incoming message using service in background in android?.

like image 468
Ujang Avatar asked Sep 20 '13 14:09

Ujang


2 Answers

Unfortunately there is no way to get Java events in delphi unless embarcadero specifically coded those events.

You can call pretty much any function or method in any class through various means but not events. Therefore you can't get the onReceive event of the broadcast receiver. The java class cannot be inherited from so you cannot override the event.

Best other option available would be to poll to check for messages but Delphi XE5 android apps can't be made into services yet..

If polling works for your needs you can follow this link: Reading text from SMS, and show it as text view

The Delphi equivalent of some of those calls:

cursor: JCursor;

uri: Jnet_Uri;

cursor := SharedActivity.getContentResolver.query(ENTER URL HERE, nil, nil,nil,nil);

while (cursor.moveToNext) do

// processing

like image 168
FerretDriver Avatar answered Sep 27 '22 23:09

FerretDriver


Here is some Delphi code for reading data from the SMS inbox:

http://delphi-android.blogspot.dk/2013/10/how-to-fetch-sms-messages-from-android.html

like image 28
Lars D Avatar answered Sep 27 '22 23:09

Lars D