android - How to know which SMS port? -


i getting sms in android application, have no idea how know port sent on. broadcastreceiver receiving sms messages, please tell me how know sms's port?

<data android:port="????" /> 

what number should there?

best regards, ekaterina

ports relevant data sms, , port-addressed messages handled data sms in android. regular text message won't have port associated it.

if want receive port-addressed messages, you'll need receiver configured data sms. receiver needs filter "android.intent.action.data_sms_received" action, rather "android.provider.telephony.sms_received" action regular text messages. data scheme "sms", , data port can specific port number, or wildcard "*" listen on ports. example:

<receiver android:name=".datasmsreceiver">      <intent-filter>         <action android:name="android.intent.action.data_sms_received" />          <data android:scheme="sms"               android:port="*" />      </intent-filter>  </receiver> 

if you're listening on multiple/all ports , need distinguish them in receiver, port number can retrieved data uri on intent passed onreceive() method. example:

int port = intent.getdata().getport(); 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -