delphi - How to get sms an event triggered when a sms arrives? Rad studio XE7 Android KitKat -



delphi - How to get sms an event triggered when a sms arrives? Rad studio XE7 Android KitKat -

i'm trying understand how event triggered when sms arrives?

i installed programme default sms/mms manager. when new message arrives, android show me error message!

it's file manifest programm:

... <application android:persistent="%persistent%" android:restoreanyversion="%restoreanyversion%" android:label="%label%" android:installlocation="%installlocation%" android:debuggable="%debuggable%" android:largeheap="%largeheap%" android:icon="%icon%" android:theme="%theme%" android:hardwareaccelerated="%hardwareaccelerated%"> <!-- our activity subclass of built-in nativeactivity framework class. take care of integrating our ndk code. --> <activity android:name="com.embarcadero.firemonkey.fmxnativeactivity" android:label="%activitylabel%" android:configchanges="orientation|keyboardhidden" android:launchmode="singletask"> <!-- tell nativeactivity name of our .so --> <meta-data android:name="android.app.lib_name" android:value="%libnamevalue%" /> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <%activity%> <receiver android:name="com.embarcadero.firemonkey.notifications.fmxnotificationalarm" /> <%receivers%> <!-- broadcastreceiver listens incoming sms messages --> <receiver android:name=".smsreceiver" android:permission="android.permission.broadcast_sms"> <intent-filter> <action android:name="android.provider.telephony.sms_deliver" /> </intent-filter> </receiver> <!-- broadcastreceiver listens incoming mms messages --> <receiver android:name=".mmsreceiver" android:permission="android.permission.broadcast_wap_push"> <intent-filter> <action android:name="android.provider.telephony.wap_push_deliver" /> <data android:mimetype="application/vnd.wap.mms-message" /> </intent-filter> </receiver> <!-- activity allows user send new sms/mms messages --> <activity android:name=".composesmsactivity" > <intent-filter> <action android:name="android.intent.action.send" /> <action android:name="android.intent.action.sendto" /> <category android:name="android.intent.category.default" /> <category android:name="android.intent.category.browsable" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </activity> <!-- service delivers messages phone "quick response" --> <service android:name=".headlesssmssendservice" android:permission="android.permission.send_respond_via_message" android:exported="true" > <intent-filter> <action android:name="android.intent.action.respond_via_message" /> <category android:name="android.intent.category.default" /> <data android:scheme="sms" /> <data android:scheme="smsto" /> <data android:scheme="mms" /> <data android:scheme="mmsto" /> </intent-filter> </service> </application> ...

fetch sms code:

function fetchsms:string; var cursor: jcursor; uri: jnet_uri; address,person,msgdatesent,protocol,msgread,msgstatus,msgtype, msgreplypathpresent,subject,body, servicecenter,locked:string; msgunixtimestampms:int64; addressidx,personidx,msgdateidx,msgdatesentidx,protocolidx,msgreadidx, msgstatusidx,msgtypeidx,msgreplypathpresentidx,subjectidx,bodyidx, servicecenteridx,lockedidx:integer; begin uri:=strtojuri('content://sms/inbox'); cursor := sharedactivity.getcontentresolver.query(uri, nil, nil,nil,nil); addressidx:=cursor.getcolumnindex(stringtojstring('address')); personidx:=cursor.getcolumnindex(stringtojstring('person')); msgdateidx:=cursor.getcolumnindex(stringtojstring('date')); msgdatesentidx:=cursor.getcolumnindex(stringtojstring('date_sent')); protocolidx:=cursor.getcolumnindex(stringtojstring('protocol')); msgreadidx:=cursor.getcolumnindex(stringtojstring('read')); msgstatusidx:=cursor.getcolumnindex(stringtojstring('status')); msgtypeidx:=cursor.getcolumnindex(stringtojstring('type')); msgreplypathpresentidx:=cursor.getcolumnindex(stringtojstring('reply_path_present')); subjectidx:=cursor.getcolumnindex(stringtojstring('subject')); bodyidx:=cursor.getcolumnindex(stringtojstring('body')); servicecenteridx:=cursor.getcolumnindex(stringtojstring('service_center')); lockedidx:=cursor.getcolumnindex(stringtojstring('locked')); while (cursor.movetonext) begin address:=jstringtostring(cursor.getstring(addressidx)); person:=jstringtostring(cursor.getstring(personidx)); msgunixtimestampms:=cursor.getlong(msgdateidx); msgdatesent:=jstringtostring(cursor.getstring(msgdatesentidx)); protocol:=jstringtostring(cursor.getstring(protocolidx)); msgread:=jstringtostring(cursor.getstring(msgreadidx)); msgstatus:=jstringtostring(cursor.getstring(msgstatusidx)); msgtype:=jstringtostring(cursor.getstring(msgtypeidx)); msgreplypathpresent:=jstringtostring(cursor.getstring(msgreplypathpresentidx)); subject:=jstringtostring(cursor.getstring(subjectidx)); body:=jstringtostring(cursor.getstring(bodyidx)); servicecenter:=jstringtostring(cursor.getstring(servicecenteridx)); locked:=jstringtostring(cursor.getstring(lockedidx)); result:=inttostr(trunc(msgunixtimestampms/1000))+' '+address+' '+body; end; end;

i'm coding rad studio xe7

get these vcl nrcomm lib & nrcomm net (http://www.deepsoftware.com/)

automatically pulls out sms gsm modem or phone.

you can write trigger insert sms details in db , delete them phone or gsm modem etc ..

android delphi sms fetch android-4.4-kitkat

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -