logo       

[android-developers] Re: About to receive the mms: msg#04249

AndroidDevelopers

Subject: [android-developers] Re: About to receive the mms


Do you have the following in your AndroidManifest.xml file?

<uses-permission android:name="android.permission.RECEIVE_MMS"/>

--
Jack Ha
Open Source Development Center
ãTã ã ãMobileã stick together

The views, opinions and statements in this email are those of
the author solely in their individual capacity, and do not
necessarily represent those of T-Mobile USA, Inc.


On Jul 31, 1:45Âam, Piano Pan <piano...@xxxxxxxxx> wrote:
> 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
-~----------~----~----~----~------~----~------~--~---

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise