它看起來是從電子郵件服務器發送的消息的真正「發件人」標籤。 [email protected]有一個不同的「發件人」標籤,那麼一旦通過短信收到郵件,郵件的詳細信息就會顯示出來。我希望能夠通過tmomail.net收到短信,但是缺少的鏈接在於手機看到的是「發件人」標籤。 我已經成功地從其他手機收到短信,我的廣播接收者抓住了他們。不過,我無法正確設置「發件人」過濾器,以便通過tmomail.net收到這些文本。預先感謝所有的諾貝爾機器人奇才,他們可能需要時間從他們的項目中獲得幫助。以下是對代碼...通過tmomail.net發送短信的「發件人」標籤
public class SmsReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// ---get the SMS message passed in---
Bundle bundle = intent.getExtras();
SmsMessage[] msgs = null;
String str = "";
Log.d("SMS_Project", "Beginning fired!");
if (bundle != null) {
// ---retrieve the SMS message received---
Object[] pdus = (Object[]) bundle.get("pdus");
msgs = new SmsMessage[pdus.length];
for (int i = 0; i < msgs.length; i++) {
msgs[i] = SmsMessage.createFromPdu((byte[]) pdus[i]);
String mFrom = msgs[i].getOriginatingAddress();
String mBody = msgs[i].getMessageBody().toString();
Log.d("SMS_Project", "The From tag follows this line");
if (mFrom.equals("[email protected]")) {
Log.d("SMS_Project", "above is the from tag");
if (mBody.indexOf("1") == 0) {
str += "SMS from '" + mFrom + "'";
str += " :";
str += mBody;
str += "\n";
// ---display the new SMS message---
Log.d("SMS_Project", "Toast anyone?");
Toast.makeText(context, str, Toast.LENGTH_LONG).show();
this.abortBroadcast();
}
}
}
}
Log.d("SMS_Project", "No toast yet");}
艙單信息:
<receiver android:name=".SmsReceiver" >
<intent-filter android:priority="99999999" >
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
這些都是我的權限:
<uses-permission android:name="android.permission.RECEIVE_SMS" />
我懷疑propblem是手機缺乏abilty的翻譯將電子郵件轉換爲合法的SMS。也許這是一個多媒體消息類型呢?我會繼續梳理藍色的地方,直到我得到這個。如果您對目前爲止有什麼問題。請告訴我。謝謝。
沒有人遇到過這樣的問題嗎? – Ccorock 2012-04-19 17:30:49