Android SMS API

I know that the SMS content provider is not part of the public API (at least not documented), but if I understand correctly, you can still use many SMS functions if you know how to use the API (?).

For example, itโ€™s quite simple to insert an SMS message into your inbox:

ContentValues values = new ContentValues(); values.put("address", "+457014921911"); contentResolver.insert(Uri.parse("content://sms"), values); 

Unfortunately, this does not cause the standard notification "new-SMS-in-your-inbox". Is it possible to run this manually?

Edit : AFAIK "standard mail application (Messaging)" on Android listens for incoming SMS messages using the permission android.permission.RECEIVE_SMS. And then, when a new SMS message arrives, a status line notification is inserted with a โ€œspecialโ€ notification identifier. Therefore, one of the solutions to my problem (outlined above) could be to search and send the correct intent to broadcast; something like "NEW CASE ARRIVED" -intent.

Change A third-party messaging app ( chompsms ) was downloaded from the Android market. This app meets my needs better. When I execute the code above, chompsms notices new sms and shows "standard status line notification". So I would say that the standard Android Messaging app does not detect sms correctly? Or am I wrong?

+7
java android
source share
3 answers

Unfortunately, the code responsible for these notifications is hidden in the messaging app . The MessagingNotification class has a static updateAllNotifications method, which you could call using PathClassLoader and reflection:

 PathClassLoader c = new PathClassLoader("/system/app/Mms.apk", getClassLoader()); Class.forName("com.android.mms.util.ContactInfoCache", true, c) .getMethod("init", Context.class).invoke(null, context); Class.forName("com.android.mms.transaction.MessagingNotification", true, c) .getMethod("updateAllNotifications", Context.class).invoke(null, context); 

This is obviously a very bad idea for several reasons, but I can't think of another way to do what you described.

+6
source share

Can you call a PUSH notification after SMS?

Subject: Does Android support approximately real-time push notification?

+1
source share

Maybe you should replace

 content://sms 

from

 content://sms/inbox 
0
source share

All Articles