我想在使用彩信时收到发送号码。 我已经完成了接收器中的发送号码,如下所示:
<receiver
android:name="com.example.orientationtest.MMSReceiver"
android:permission="android.permission.BROADCAST_WAP_PUSH" >
<intent-filter>
<action android:name="android.intent.action.DATA_SMS_RECEIVED" />
<data android:scheme="sms" />
<data android:host="localhost" />
</intent-filter>
<intent-filter>
<action android:name="android.provider.Telephony.WAP_PUSH_RECEIVED" />
<data android:mimeType="application/vnd.wap.mms-message" />
</intent-filter>
</receiver>
但是在mms发送模式下我无法获得发送号码。 当我尝试发送彩信时,我只想抓一个发送号码。
请有人帮助我。 THX。
<uses-permission android:name="android.permission.SEND_MMS" />
答案 0 :(得分:0)
无法为短信息发送事件注册接收者,请参阅此帖子:Android Broadcast Receiver for Sent SMS messages?
有一种方法可以获取设备的电话号码,请参阅此帖子:https://stackoverflow.com/a/2480307/4409409
请务必阅读评论中的注意事项。尽管这似乎是获取设备电话号码的最佳方式,但并不能保证能够在所有设备上运行。
文档:http://developer.android.com/reference/android/telephony/TelephonyManager.html#getLine1Number()