나는 안드로이드 응용 프로그램에서 sms의 작은 문제에 직면하고 있습니다. 내가 메시지를 보내고있는 수신자 주소를받는 데 도움이 필요합니다.sms android receive function
샘플 코드는 아래와 같습니다.
public void oncall() {
// public void onReceive(Context context, Intent intent) {
// ---get the SMS message passed in---
Bundle bundle = new Bundle(); // intent.getExtras();
SmsMessage[] msgs;
// String str = "";
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 Mobno = msgs[i].getOriginatingAddress();
// String message = msgs[i].getMessageBody().toString();
output.setText("" + Mobno);
}
// ---display the new SMS message---
// Toast.makeText(context, str, Toast.LENGTH_SHORT).show();
}
}
어떤 오류 U는 U = Mobno 문자열을 사용하는 MSG를 받고 [I] .getOriginatingAddress(); u는 휴대 전화 번호 – user1203673
에 오류에 대한 설명이 없습니다 ... -1. – JoxTraex
나는 비슷한 것을하고있다 !!! http://stackoverflow.com/questions/14452808/sending-and-receiving-mms-in-android – toobsco42