Hi Moneytoo, Is there a way to monitor changes in the outbox through an official API?
I need to be able to listen out for an sms message beinging sent and be able to deal with that through my own application. However I have been researching the official API and I cant find anything that will let me do this? Is there some way of doing it with the official API that I have missed? Thanks in advance On 15 Jan, 18:58, moneytoo <[email protected]> wrote: > Use content://mms-sms instead if you must but I would recommend you to > stick with the official API. > > On Jan 15, 3:50 pm, "[email protected]" <[email protected]> wrote: > > > Hi all, > > > I keep getting the following error: > > > 01-15 12:29:28.155: ERROR/DatabaseUtils(115): > > java.lang.SecurityException: Permission Denial: reading > > com.android.providers.telephony.SmsProvider uri content://sms from > > pid=1004, uid=10054 requires android.permission.READ_SMS > > > Even though I have the persmission READ_SMS in my manifest, I have > > tried it both outside the application tags and inside, neither way > > seems to work and the same error keeps popping up > > > Here is my manifest: > > > XML: > > <?xml version="1.0" encoding="utf-8"?> > > <manifest xmlns:android="http://schemas.android.com/apk/res/android" > > package="cicero.org" > > android:versionCode="1" > > android:versionName="1.0"> > > <application android:icon="@drawable/icon" android:label="@string/ > > app_name"> > > <activity android:name=".TestApp" > > android:label="@string/app_name"> > > <intent-filter> > > <action android:name="android.intent.action.MAIN" /> > > <category > > android:name="android.intent.category.LAUNCHER" /> > > </intent-filter> > > </activity> > > <activity android:name=".SettingsApp" > > android:label="@string/app_name"> > > <intent-filter> > > <action android:name="android.intent.action.SETTINGS" / > > > <category > > android:name="android.intent.category.LAUNCHER" /> > > </intent-filter> > > </activity> > > <provider android:name=".CiceroContentProvider" > > > android:authorities="cicero.org.CiceroContentProvider" > > android:multiprocess="true" /> > > > <receiver android:name=".SMSApp"> > > <intent-filter> > > <action > > android:name="android.provider.Telephony.SMS_RECEIVED" /> > > </intent-filter> > > </receiver> > > > </application> > > <uses-sdk android:minSdkVersion="3" /> > > <uses-permssion android:name="android.permission.READ_SMS"/> > > <uses-permission android:name="android.permission.READ_CONTACTS"/> > > <uses-permission android:name="android.permission.WRITE_CONTACTS"/ > > > <uses-permission > > android:name="android.permission.ACCESS_WIFI_STATE"/> > > <uses-permission > > android:name="android.permission.CHANGE_WIFI_STATE"/> > > <uses-permission android:name="android.permission.WAKE_LOCK"/> > > <uses-permission > > android:name="android.permission.PROCESS_OUTGOING_CALLS"/> > > <uses-permission android:name="android.permission.CALL_PHONE"/> > > <uses-permission android:name="android.permission.RECEIVE_SMS"/> > > <uses-permssion android:name="android.permission.WRITE_SMS"/> > > </manifest> > > > Anybody got any ideas if I'm missing something else or why the > > permission is not getting recognized in the manifest? > > > Here is my code that I am using: > > > //in onCreate() > > > String url = "content://sms/"; > > Uri uri = Uri.parse(url); > > getContentResolver().registerContentObserver(uri, true, new > > MyContentObserver(handler)); > > > //own class > > class MyContentObserver extends ContentObserver { > > > public MyContentObserver(Handler handler) { > > > super(handler); > > > } > > > @Override public boolean deliverSelfNotifications() { > > return false; > > } > > > @Override public void onChange(boolean arg0) { > > super.onChange(arg0); > > > Log.v("SMS", "Notification on SMS observer"); > > > Message msg = new Message(); > > msg.obj = "xxxxxxxxxx"; > > > handler.sendMessage(msg); > > > Uri uriSMSURI = Uri.parse("content://sms/inbox"); > > Cursor cur = getContentResolver().query(uriSMSURI, null, null, > > null, null); > > cur.moveToNext(); > > String protocol = cur.getString(cur.getColumnIndex > > ("protocol")); > > if(protocol == null) > > Log.d("SMS", "SMS SEND"); > > else > > Log.d("SMS", "SMS RECIEVE"); > > > } > > > Anybody got any ideas if I'm missing something else or why the > > permission is not getting recognized in the manifest or is it my code > > that is doing something that is currently not allowed?
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

