Beispiel #1
0
 /**
  * Might be deprecated soon, check {@see <a href=
  * "http://developer.android.com/reference/android/telephony/SmsMessage.html#createFromPdu(byte[])"
  * >source</a> }
  *
  * @param intent
  */
 public YSMSEvent(Intent intent) {
   Bundle data = intent.getExtras();
   // YLog.d("SMS", data.toString());
   Object messages[] = (Object[]) data.get("pdus");
   SmsMessage smsMessage[] = new SmsMessage[messages.length];
   for (int n = 0; n < messages.length; n++) {
     smsMessage[n] = SmsMessage.createFromPdu((byte[]) messages[n]);
     YLog.d("SMS", n + " | " + smsMessage[0].getMessageBody());
   }
   mSender = smsMessage[0].getOriginatingAddress();
   mMessage = smsMessage[0].getMessageBody();
 }