Note that there are some explanatory texts on larger screens.

plurals
  1. PODetecting MMS messages on Android
    primarykey
    data
    text
    <p>I was searching through the internet for this topic and couldn't find any satisfying answer... I'm trying to detect MMS messages (incoming at least for start). And I've decided to go through the way of detecting changes in the contents. I've downloaded Android codes and made sure that I'm using correct content provider: "content://mms" (in android.provider.Telephony.Mms class) and I'm using all needed permissions (from Mms application) I've come up with a sample application that detects incoming MMS messages, how ever it does not detect them. here is the application:</p> <pre><code>package com.kolomiyets.MMStesting; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.database.ContentObserver; import android.net.Uri; import android.os.Bundle; import android.widget.TextView; public class MMStesting extends Activity { public static final String MMSMON_RECEIVED_MMS = "MMStesting.intent.action.MMSMON_RECEIVED_MMS"; Uri mmsInURI = Uri.parse("content://mms"); ContentObserver mmsObserver = new ContentObserver(null) { @Override public void onChange(boolean selfChange) { Thread mmsNotify = new Thread(){ @Override public void run() { Intent mIntent = new Intent(MMSMON_RECEIVED_SMS); sendBroadcast(mIntent); super.run(); } }; mmsNotify.start(); super.onChange(selfChange); } }; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); BroadcastReceiver mmsMonitorBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { TextView log = (TextView)findViewById(R.id.mms_log); log.append("\n MMS Received;"); } }; IntentFilter mIntentFilter = new IntentFilter(); mIntentFilter.addAction(MMSMON_RECEIVED_MMS); registerReceiver(mmsMonitorBroadcastReceiver, mIntentFilter); getApplicationContext().getContentResolver().registerContentObserver(mmsInURI, true, mmsObserver); getApplicationContext().getContentResolver().notifyChange(mmsInURI, mmsObserver); } @Override protected void onDestroy() { getApplicationContext().getContentResolver().unregisterContentObserver(mmsObserver); super.onDestroy(); } } </code></pre> <p>and the manifest:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.kolomiyets.MMStesting" android:versionCode="1" android:versionName="1.0"&gt; &lt;uses-sdk android:minSdkVersion="4" /&gt; &lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/&gt; &lt;uses-permission android:name="android.permission.CALL_PHONE"/&gt; &lt;uses-permission android:name="android.permission.READ_CONTACTS"/&gt; &lt;uses-permission android:name="android.permission.WRITE_CONTACTS"/&gt; &lt;uses-permission android:name="android.permission.RECEIVE_SMS"/&gt; &lt;uses-permission android:name="android.permission.RECEIVE_MMS"/&gt; &lt;uses-permission android:name="android.permission.SEND_SMS"/&gt; &lt;uses-permission android:name="android.permission.VIBRATE"/&gt; &lt;uses-permission android:name="android.permission.INTERNET"/&gt; &lt;uses-permission android:name="android.permission.READ_SMS"/&gt; &lt;uses-permission android:name="android.permission.WRITE_SMS"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt; &lt;uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/&gt; &lt;uses-permission android:name="android.permission.READ_PHONE_STATE"/&gt; &lt;uses-permission android:name="android.permission.WAKE_LOCK"/&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt; &lt;uses-permission android:name="android.permission.INSTALL_DRM"/&gt; &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt; &lt;activity android:name=".MMStesting" android:label="@string/app_name"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; </code></pre> <p></p> <p>So far I tried "content://mms-sms" and application starts detecting something endlessly after device receives MMS message. There is no indication about new MMS in the status bar(as it should be), however the message appears in the incoming messages o_O...</p> <p>Also I tried putting "content://sms" and everything works as it supposed to (detection of incomming and outgoing SMSs and even MMSs o_O)</p> <p>Do I misunderstand something? Is there a way to correct my app so it would detect changes in "content://mms"? If it does not work in this app, than I won't be able to use this content in my database requests? If I'll detect changes with "content://sms" how can I distinguish between SMS and MMS? (I'd like to get what is in MMS as well). Or may be the best idea is just taking all those classes from android sources and trying to modify them the way I want? ...But I would'n like to do it)))</p> <p>Here is a</p> <p><a href="http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/1.6_r2/android/provider/Telephony.java?av=f" rel="noreferrer">grepcode.com: Telephony class that contains MMS calass</a> (also this site is convenient for browsing android source code)</p> <p>This information somewhat describes, how to retrieve information from MMS messages that are in the database. However, I still can't figure out the way to <strong>detect</strong> ingoing and outgoing MMS messages. </p> <p>It looks like to me that I have to to monitor "content://sms" in order to detect MMSs (since "content://sms" reacts on incoming MMSs and "content://mms" does not), and than work with "content://mms" over Cursor and ContentResolver.</p> <p>But I'm not sure this is a right way... Also I don't understand what actually Part (or PduPart) represents... will i get a complete picture by retrieving Part from MMS or it will be a part of the picture? And is there any difference between "content://mms//part" and "content://mms/part/"?</p> <p>Here is also an interesting moment with WAP Push Messages. As far as I've understood these represent some kind of some special SMS messages with hyper links, and they are also used to transfer configurations from mobile provider to client's phone. This class:</p> <p><a href="http://code.google.com/p/android-notifier/source/browse/trunk/AndroidNotifier/src/org/damazio/notifier/service/MmsReceiver.java?r=141" rel="noreferrer">code.google.com: MmsReceiver.java</a> is supposed to detect MMS messages with help of WAP Push Massages. </p> <p>I really can't make sense out of it. How?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload