|
[android-developers] About to receive the mms: msg#04186AndroidDevelopers
I use the BroadcastReceiver to get the MMS information, but the onReceive can not get the message when MMS coming. Code as following: private static final String ACTION_SMS_RECEIVED = "android.provider.Telephony.SMS_RECEIVED"; private static final String ACTION_MMS_RECEIVED = "android.provider.Telephony.WAP_PUSH_RECEIVED"; private static final String MMS_DATA_TYPE = "application/ vnd.wap.mms-message"; public int RegistReceiver() { IntentFilter filter = new IntentFilter(); filter.addAction(ACTION_MMS_RECEIVED); filter.addAction(ACTION_SMS_RECEIVED); try { filter.addDataType(MMS_DATA_TYPE); } catch (MalformedMimeTypeException e){ } this.registerReceiver(this.mReceiver, filter); return 0; } public int UnregisterReceiver() { this.unregisterReceiver(this.mReceiver); return 0; } class MSGTestReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); String dataType = intent.getType(); if (ACTION_SMS_RECEIVED.equals(action)) { MDebug.V("Message is a SMS"); } else { MDebug.V("Message is a MMS"); } } } This code can work when SMS coming. Does anybody give me some comments? Regards Pan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@xxxxxxxxxxxxxxxx To unsubscribe from this group, send email to android-developers-unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---
|
|
||||||||||||||||||||||||||
|
|
|
| News | Mail Home | sitemap | FAQ | advertise |