I'm creating little sms app, and after receiving it with my Broadcast receiver it is supposed to be present in inbox and it should be accessible to other sms apps as well, but it is not. It looks like no message was received at all. This issue occurs only when my app is default SMS app. Do I need to manually add received SMS to inbox after receiving it?
Do I need to manually add received SMS to inbox after receiving it?
Yes. The default SMS app is responsible for writing incoming messages to the Provider.
Reference
Related
I know that in newer android api levels its not possible to abort received sms broadcast or delete received or sent sms.Even when we send sms from SmsManager it is saved in inbox.
My first question is.Is there any way to delete sms in android 6.0 or atleast change received sms status to already read.
Second is there anyway to send sms silently which does not save itself in inbox.
Is there any way to delete sms in android 6.0 or atleast change received sms status to already read.
No. Its not possible unles you make your app default SMS. Starting from Andriod Kitkat only SMS default app has capability to Write data to the provider
Second is there anyway to send sms silently which does not save itself in inbox.
You can send Binary SMS which won't be visible in the Inbox/Sent box
My aim is to show notification and the sms message in inbox of app only from a specific broadcast sender. But using broadcast reciever with Telephony.SMS_RECEIVED receives the sms in the app as well as the main android phone's inbox. So the result is redundant message notifications and backups in phone default inbox as well as app inbox.
Following link shows how to create default sms app for android 4.4 and above for all the senders.
https://android-developers.googleblog.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html
Also, for older versions, abortBroadcast() was used for receiving the sms into a specific app only.
But I want to make an application that notifies and saves the messages only from a particular sender as it is only application specific. Also the message must not go to any other sms inbox apart from app
Is there anyway to do the same ? Or can data sms with specific port number help ?
Usecase: The message to be notified by the app is a user specific message or a broadcast sms. The app has to notify the user of the message even when app is not open,
I'm developing one messaging app, in which the incoming messages will be stored in its own inbox. But it is storing in both native message inbox & app inbox same time.
How to prevent messages reaching to native inbox before reaching to the app?
Call abortBroadcast() in the BroadcastReceiver when you're done adding the message to your inbox. Make sure that your receiver's priority is higher than that of the other messaging app.
I write application which will get data from received SMS. This is data only for application and I dont want to user can read this message. Is possible to consume SMS just after get data from them to prevent user from reading this SMS? Thanks for any help.
You will need a sms receiver see http://davanum.wordpress.com/2007/12/15/android-listen-for-incoming-sms-messages/
Maybe you need also to delete the received sms.
Yes, this is easy to do. See my answer here for how to do this:
SMS receive with no notification
Once you've confirmed that the SMS is one of your special ones, you just need to call abortBroadcast() to stop it going into the user's inbox:
// Stop it being passed to the main Messaging inbox
abortBroadcast();
You should also be aware that the SMS receiver will not intercept SMS messages sent to the user's Google Voice number, as by default those messages will be downloaded over the data connection and displayed by the Google Voice app. If their Google Voice number is configured to forward the SMSs to the phone then those will be handled fine by the SMS receiver.
I am developing the app which holds the messages in it's own inbox rather than the native inbox.
This can be achieved only if the incoming messages are prevented from reaching the native inbox.
There is some attribute android:priority in <intent-filter>, by which message can be first received by current receiver than others.
But I do not know how to do it properly, does anyone know?
I assume you mean SMS messages? The best, and only AFAIK, is to receive the message via registering the proper BroadcastReceiver object, copying the message into your database, marking it is read in the SMS ContentProvider and then deleting it from the SMS ContentProvider. Check out this article on how to receive SMS messages and then check out this SO post on how to use the SMS content provider.
Edit I actually stand corrected, there is another method that I've had sometimes limited success with. In the BroadcastReceiver you can call the abortBroadcast() method to cancel the broadcast. The important thing here is that you register your receiver with an intent filter that has a higher priority (say, 100) so that it receives the SMS before anybody else does.