PORT SMS IMPLMENTATION IN ANDROID

 Port sms working principle:

           Application port numbers can be used in SMS messages to deliver a particular SMS to an application on a mobile phone. The application port addressing feature of SMS messages allows specifying a source port and a destination port number for an SMS message .

             The Port sms working principle is shown below in the diagram

                            1.1 port sms working principle

 Receiving Message      

 To receive a binary message we create broadcast receiver with android.intent.action.DATA_SMS_RECEIVED. We also need to specify additional parameters, the receiving data port and the scheme.

  For reference:

 <receiver

           android:name=”com.tam.mpos.notification.NotificationReceiver

           android:exported=”true” >

           <intent-filter android:priority=”999” >

               <action android:name=”android.intent.action.DATA_SMS_RECEIVED” />

               <data android:port=”8900” />

               <data android:scheme=”sms” />

           </intent-filter>

 </receiver>

additionally we need to add permissions to receive and to read sms.

 Permissions:

  <uses-permission android:name=”android.permission.READ_SMS” />

  <uses-permission android:name=”android.permission.RECEIVE_SMS” />

Notification Database Structure

            Once the application received the message from server we are storing internally into the database.

Notification Table:

Database name: Operatorlist.db

     Table Name: Notification Table

thread_id

address

date

read

body

service_centre

1

919840901970

12/10/2012

1

Welcome to Yeldi Ara !!

+919840011016

2

919840901970

12/10/2012

1

Hello Merchant !!

+919840011016

3

919840901970

23/11/2012

0

Plese Update your Yeldi App!!

+919840011016

4

919840901970

30/11/2012

1

You reached 1000 transactions.Thanks be a part of Yeldi !!

+919840011016

                                                 Notification Table Structure.

      Note:

             The field read have two status 0 and 1 , 0 for unread message

            1 for read message.

Notification Receiver Class: Continue reading