It is a recurrent question but I wasn't able to find a complete enough documentation on this topic.
I already have a working application able to intercept SMS, when it is send with default parameter with kannel or other device. My manifest look like this :
<receiver
android:name=".sms.SMSListener"
android:enabled="true" >
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
It works both with android.provider.Telephony.SMS_RECEIVED
and android.intent.action.DATA_SMS_RECEIVED
.
But for the purpose of my application, the SMS must not appear in the user-inbox. For that, kannel sent the SMS to a specific port. It is already working on Blackberry, so I guess the sending part of the problem is already working.
Also it may be possible to achieve this goal via other means, I need to implement this solution in order to stay coherent with other similar project. Another reason for that, is to avoid my BroadcastReceiver
to be fired at each received SMS (and thus needing to parse each received SMS).
However with my current manifest, I don't receive SMS sent to a specific port (my receiver isn't fired at all). After some research, I found those topic how to receive text sms to specific port.., How to send and receive data SMS messages. Someone say that adding :
<data android:scheme="sms" />
<data android:port="1234" />
is enough to work (unfortunately, it doesn't works for me). However according to the documentation ( http://developer.android.com/guide/topics/manifest/data-element.html ) you need to specify the android:scheme
then the android:host
in order for android:port
to be taken into account. As far as I understand the documentation, you could just specify android:scheme
and the intent-filter should still be functionnal.
However as soon as I specify the android:scheme
, my BroadcastReceiver
cease to work, whether or not I send the sms with a specific port :
<receiver
android:name=".sms.SMSListener"
android:enabled="true" >
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
<data android:scheme="sms" />
</intent-filter>
</receiver>
So my questions are the following:
- is there somewhere a documention about which value
android:scheme
can take ? - which value should I use for
android:host
? - is there somewhere an app which listen SMS to every port so I can be sure that the test SMS is correctly sent (just to double check this part) ?