May 15 |
3:50 PM |
Mark M. |
has entered the room |
Mark M. |
turned on guest access |
May 15 |
4:00 PM |
Susheel C. |
has entered the room |
Mark M. |
hello, Susheel!
|
Mark M. |
how can I help you today?
|
Susheel C. |
Hi Mark, how are you
|
Susheel C. |
I have a couple of questions
|
Susheel C. |
1) When I receive an incoming text, I want to identify its coming from a specific number and then trigger my application. How can I do that?
|
May 15 |
4:05 PM |
Mark M. |
I would assume getOriginatingAddress() on SmsMessage would tell you the number
|
Mark M. |
however, you cannot have an <intent-filter> for a specific sending phone number
|
Mark M. |
so your application will be "triggered" for all incoming SMS messages
|
Mark M. |
your BroadcastReceiver can see if the SmsMessage has the desired phone number and decide what to do from there
|
Susheel C. |
ok
|
Susheel C. |
I'm a little confused. So if I want to start my application only when I receive texts from a specific number, can I do that?
|
Mark M. |
what do you mean by "start my application", specifically?
|
Susheel C. |
I want my app to be launched
|
Mark M. |
what do you mean by "my app to be launched", specifically?
|
Mark M. |
do you mean you want an activity to appear? if so, why do you think the user wants to be interrupted right then?
|
Susheel C. |
Yes, I want an activity to appear. You're right. I should probably use a notification.
|
Mark M. |
either way, SMS messages come into a BroadcastReceiver
|
Mark M. |
that BroadcastReceiver can examine the SmsMessage object to see if it is from your desired phone number
|
Mark M. |
if it is, it can raise the Notification
|
May 15 |
4:10 PM |
Susheel C. |
Would it then be possible to receive and 'view' text messages from other numbers as usual without them triggering any events?
|
Mark M. |
by definition, receiving a text message is an event
|
Mark M. |
your BroadcastReceiver will receive all text messages on Android 4.4+
|
Mark M. |
it will receive all text messages that have not been consumed by a higher-priority receiver on 4.3 and below
|
Mark M. |
what you choose to do with those messages, such as examine their phone numbers and conditionally raise a Notification, is largely up to you
|
Susheel C. |
ok
|
May 15 |
4:15 PM |
Susheel C. |
I have another question now....I apologize if the question is too broad...
|
Susheel C. |
there is a self text writing animation in the hyperlink: http://s449.photobucket.com/user/ine07jasoncase... you tell me if this can be implemented in android? If yes, how?
|
Mark M. |
you can certainly draw on a Canvas
|
Mark M. |
can you draw on a Canvas in an animated fashion that simulates handwriting? presumably
|
Mark M. |
but that is outside of my skill set
|
Susheel C. |
ok
|
May 15 |
4:30 PM |
Susheel C. |
Thank you for your help Mark :)
|
Mark M. |
you are very welcome
|
Susheel C. |
has left the room |
May 15 |
5:00 PM |
Mark M. |
turned off guest access |