Hello all i will explain my question a little more. I'm not native english speaker. So maybe my question is on the internet but when i search i only found something i already know.
I have a Xperia U with the illumination barre. I use it as a notification for sms. I already know how to receiver SMS and the event of unlock screen
What i will now is 2 thing.
1- Possibility to know if the last sms was read by the user or not(My apllication is just a notification center and not a sms handler so the sms reading is doing by official app or user app like gosms)
2- Possibility to know if phone is already unlock, i will remove notification if it is.
I'm not very clear but i find this difficult to explain if you don't undestand the question say it i will reformulate it.
Possibility to know if the last sms was read by the user or not(My apllication is just a notification center and not a sms handler so the sms reading is doing by official app or user app like gosms)
There is no concept of Read in SMS. You can get a delivery notification for when it reaches the user's device, but you can't tell if the user read it or not.
Possibility to know if phone is already unlock, i will remove notification if it is.
You will need to dynamically register a BroadcastReceiver for ACTION_SCREEN_ON and ACTION_USER_PRESENT broadcasts.
Related
I have never developed something in Android before, but now my company has put me on a project which includes android.
My question is this: Is it possible to write an application that runs in the background and waits for triggers (if that is the correct word for it). For instance lets say I want my application to do something as soon as you open your emails or as soon as you get an email. Is there some API that I can use to interact with other applications such as Mail. The application does not have to have any GUI, it will literally just push some information notifications on the mail just received or opened.
I don't require a to technical answer, but rather just yes or no, and indeed yes, where can I get more info on it. Also if it is not possible, is there some workaround to achieve this. I have googled it, but most of the links are how to send an email from your application.
Thanks
EDIT: So it can even be triggered when a notification is received. Then I just want to look at the notification and determine if it is an email?
You could register BroadCastReceiver for the actions that you need to be caught
sorry fo my complete ignorance developing an Android.
I'm asking about the feaseability of this pseudocode I would like to implement as native app; let imagine a task that:
when a specific SMS arrive (only those sent from a specific sender number)
possibly (multi-SMS in case of text bigger than 160 chars )
elaborate/format each received SMS:
. save text content on a local db
. print text on a bluetooth printer
. reply to sender with some sort of "ACK" SMS
BTW, what above could be sort of background task, and I would need on foreground a sort of user interface that visualizes received SMS and do some user actions (sending back SMS to sender)
Is all that possible on Android ? Any issue ?
I mean, above all: is possible to "catch" specific SMSs (by example those sent by a specific sender number), living unalterated the usual SMS workflow for ALL other SMSs ?
Sorry for my beginner question and Thanks for your patience
giorgio
www.giorgiorobino.com
Following this link to implement a BroadcastReceiver that will listen for incoming SMS.
Inside your onReceive from your BroadcastReceiver, handle your logic (print/save/..)
It is possible, yes. But not recommended. That being said the way to set this up is to catch the SMS intent, so your app would be started when an SMS is received. Otherwise it would not run at all (as long as you don't have any other interface open). For a code example on the message interception part, see this post. For the database part look up local storage on android phones. Look up on SMS messaging for the reply. Not sure how bluetooth printing would work as I've never done it, but if it's a standard protocol I'm sure there's either built in support or a library for it.
I am currently developing a simple sms alarm which plays an alarm whenever a certain number is texting you or when a certain word is showing up in the message.
Now i want to do the same thing, but with notifications.
I want my app to alert me when certain word appears in the notification title or text.
My question is, it is possible to catch all the notifications in a broadcast receiver like i do with the sms?
One possible way, that would not read everything in the notification would be to set up your application as Accessability application that's allowed to listen to (pretty much) everything.
But in 4.3 they have added the NotificationListenerService. Best guideance is probably to look at the docs. There's an another example available: https://github.com/kpbird/NotificationListenerService-Example
I write sms messenger and have one problem. When user reads sms from my app and deletes them from my app, other apps and notification bar still show that one or more sms as unread. And when the user try to open sms, for example, from notification, other sms messenger didn't show unread sms beacause it was deleted from base from my app.
Is there any way to refresh sms apps and notification that would not show that sms not read?
Thanks!
I don't think there is a way to do this. Furthermore it shouldn't be you job to care about this, it's the job of the other apps to show always the most current data.
But you can show some advised to the user when he starts your app for the first time. GO SMS for example advises the user to turn off the SMS notification of all other SMS applications on the device. I think the reason for this is similar to your issues.
I'm developing an app where the user selects contacts from his/her address book and then the app prevents them from texting said people. My problem is that I can't find any code to prevent texting people. I've found apps that prevent you from calling certain contacts but I'm more focused on texting. Any help would be appreciated.
-Thanks
I believe it's not possible for reasons specified at Android Broadcast Receiver for Sent SMS messages?
It seems that no Broadcast is made for outgoing SMS, so unlike calls, you can't adjust the content (number) or prevent it completely.