SmsManager.sendDataMessage(...,onSpecificPort,...,..)是不是过滤短信在港口基础 [英] SmsManager.sendDataMessage(..., onSpecificPort , ...,.. ) Is not Filtering SMS On Port Basis

查看:1081
本文介绍了SmsManager.sendDataMessage(...,onSpecificPort,...,..)是不是过滤短信在港口基础的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要做的就是

发送短信在一个特定的端口和应用听短信收到相同的端口只能反应短信接收。

Send SMS on a specific PORT and application listening to sms receiving for the same port should only react to the sms receiving.

我有一个接收器像这样

    <receiver android:name=".BinarySMSReceiver"> 
        <intent-filter> 
            <action android:name="android.intent.action.DATA_SMS_RECEIVED"/>
            <data android:port="8091"/>
            <data android:scheme="sms"/> 
        </intent-filter> 
    </receiver>

和发送SMS等低于

manager.sendDataMessage(phonenumber, null, (short) SMS_PORT, data, piSend, piDelivered);

MyReceiver确实收到了味精,但沿边其他问题的接收器也能听。

MyReceiver did receive the msg but issue along side others receivers are also able to listen.

我的设备的本地的收件箱也被抓住的短信。

My native inbox of device is also catching the sms.

如果我宣布以不同的端口号的另一个接收器,他们也能听。
我的日志验证。

If i declare another receiver with different port number they are also able to listen. verified with my logs.

如果我更改端口号,我的第一个接收器即使如此,它接收。

or if i change port number for my first receiver even then it receives .

只有上帝知道为什么这个端口是没有过滤的短信。

Only god know why this port is not filtering sms.

请给建议。
任何指示或暗示,或解决方案的欢迎。

Please gave suggestions. Any direction or hint or solution are welcomed.

感谢

推荐答案

的回答是,这个端口过滤功能不适用于不同厂商所有设备正常工作。

Answer is that this port filtering doesn't work well for all the devices of different manufacturers.

解决方法是

尝试发送简单的文本信息。
随着在邮件正文中添加一些自己的头信息
让你的接收者知道,这是你的短信。

Try sending simple text messages. With in the message body add some of your own header information to let your receiver know that it is your sms.

如同

消息体=// someHeaderPattern:+消息体;

messageBody = "//someHeaderPattern:" + messageBody;

让你的接收机的聆听优先级非常高。

make your receiver listening priority very high.

如果您的接收器检测,是你的短信。 abortBroadcast避免其他听一样。
别的什么都不做。

If your receiver detect its your sms. abortBroadcast to avoid other listen the same. else do nothing.

这只是一种变通方法没有什么保证。

This is just a workaround nothing is guaranteed

这篇关于SmsManager.sendDataMessage(...,onSpecificPort,...,..)是不是过滤短信在港口基础的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆