Recognize/React on incoming SMS

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

Postby mjpan » Fri Dec 28, 2007 8:00 pm

Hi plusminus,
yup, nothing came through the other side.
i'll add post to GoogleGroups and see what the response is.



plusminus wrote:Hello mjpan,

did you try the Category-Thing :?:

There is no official Bug-Tracking-System yet, but on my Bugs posting them to the GoogleGroups and hoping a moderator would see them was fine ^^.

Regards,
plusminus
mjpan
Freshman
Freshman
 
Posts: 4
Joined: Mon Dec 24, 2007 2:30 am

Top

Postby Alexey Klokov » Sat Jan 12, 2008 11:16 pm

Hi guys,

May be you know, i have the common question about Android notifications.
For example if i have 2 applications which wants to recieve incoming SMS notification.
What application executed first?

I code we wrote:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. /* Consume this intent, that no other application will notice it. */
  2.  
  3.                this.abortBroadcast();
Parsed in 0.029 seconds, using GeSHi 1.0.8.4


How i can be shure that first(for instance) application will get notification instead of second.

Thanks!!!

PS
This question comes from simple example. If i have a phone with default Messaging client, and additionaly download and install alternative Messaging application, which one will work????
Alexey
Alexey Klokov
Freshman
Freshman
 
Posts: 3
Joined: Sat Nov 17, 2007 3:35 pm
Location: Nizhniy Novgorod, Russia

Postby plusminus » Sun Jan 13, 2008 12:51 am

Hello Alexey,

I had questioned that myself and wrote down what the system does :src: here (similar case, when making a DIAL-Replacer).

Basically the system will ask the user which one he/she wants to be started (at this time, the system does not remember the user choice and asks always again).

Hope this helped you.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby Alexey Klokov » Sun Jan 13, 2008 11:15 am

plusminus,

Thank you! Now i understand how it works.

ragerds
Alexey
Alexey
Alexey Klokov
Freshman
Freshman
 
Posts: 3
Joined: Sat Nov 17, 2007 3:35 pm
Location: Nizhniy Novgorod, Russia

System Messages

Postby GodsMoon » Tue Jan 29, 2008 9:35 pm

So has anybody figured out how to pass system messages between phones without spamming the SMS or XMPP inbox?
GodsMoon
Developer
Developer
 
Posts: 26
Joined: Mon Dec 10, 2007 5:13 pm

Re: System Messages

Postby Alexey Klokov » Tue Jan 29, 2008 9:52 pm

GodsMoon wrote:So has anybody figured out how to pass system messages between phones without spamming the SMS or XMPP inbox?

Hi GodsMoon,
what's mean "system messages"?
U see, any phone has a service(GSM or CDMA or any other). And phones can communicant using SMS messages or though internet connection. Actually you can use another methods - wifi, bluethooth and etc.
But this is just a transport layer for your application. I'm confusing about SYSTEM messages? Could give a details.
Alexey
Alexey Klokov
Freshman
Freshman
 
Posts: 3
Joined: Sat Nov 17, 2007 3:35 pm
Location: Nizhniy Novgorod, Russia

Top

System Messages

Postby GodsMoon » Wed Jan 30, 2008 2:31 am

I'm talking about the "P2P Services Using XMPP" section from http://code.google.com/android/toolbox/google-apis.html

apparently you can intercept sms messages so the user doesn't see them, but that usually cost money. (though I'm not sure how to do that). Anyway, I would like to send messages back and forth between phones without alerting the user every time I receive a new message from the other phone. Can you do this with XMPP? The link above doesn't really say...

Has anybody done this without a 3rd party server?

thanks
GodsMoon
Developer
Developer
 
Posts: 26
Joined: Mon Dec 10, 2007 5:13 pm

Postby Ishtar » Thu Jan 31, 2008 4:27 pm

sms-compression app

nice :o why didn't i think of that?

Ishtar
Ishtar
Experienced Developer
Experienced Developer
 
Posts: 50
Joined: Wed Jan 16, 2008 10:22 pm
Location: Netherlands

Postby plusminus » Thu Jan 31, 2008 8:20 pm

Ishtar wrote:sms-compression app

nice :o why didn't i think of that?

Ishtar


its not yet finished at all, because Android does not yet provide a centralized storage for sms' :)

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby sebi » Sat Feb 02, 2008 6:56 pm

plusminus wrote:
Ishtar wrote:sms-compression app

nice :o why didn't i think of that?

Ishtar


its not yet finished at all, because Android does not yet provide a centralized storage for sms' :)

Regards,
plusminus

Hi plusminus,

Thanks for your tutorial. I have actually successfuly stored incoming sms' using the right content provider . I will post the code but now I'm posting from a computer where i do not have this code . The sms' are correctly stored into the database (I was able to browse the records through the sqlite console in adb). However , retrieving sms' is not possible , as you have told on the google android group. We are facing a bug (Class cast exception with the cursor class). I tried to up the post but no one is reacting on it.

I really need this functionality so i'm about to rewrite an home-made content provider in order to retrieve sms' from the database. Other solution is to write an sqlLite class but not so nice because we are not using a content provider. Last solution, is that this bug will be resolved in the newt release of the SDK.
sebi
Freshman
Freshman
 
Posts: 3
Joined: Sun Jan 06, 2008 11:00 am

Postby plusminus » Sat Feb 02, 2008 7:52 pm

Hello sebi,

i hope the bug will be fixed with the next SDK-update (we are already waiting 6 weeks for an update :( ).
Doing sth on our own will/should definitely get replaced later by some code from the Google-Guys, just for compatibility to other apps.

But i would really appreciate you posting your code/halfworkaround to anddev :)

Best Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby sebi » Sat Feb 02, 2008 8:39 pm

well, that's the code to store an message into the database. please note that it is incomplete as it only store the body of the message but storing a complete message is just a matter of completing your cotentValue object.

I added this code inside the for loop of the SmsReceiver class :
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. ContentValues contentValues = new ContentValues();
  3.  
  4.                         contentValues.put(android.provider.Telephony.Sms.BODY, currentMessage.getDisplayMessageBody());
  5.  
  6.                    
  7.  
  8.  ContentURI uri =context.getContentResolver().insert(android.provider.Telephony.Sms.CONTENT_URI, contentValues);
  9.  
  10.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


That's it, quite simple :-).

I cannot post yet my code for retrieving sms cause for the moment it's only exist in my head ;-) and i've to find some time to implement (I will made an highly use of the notepad provider sample)
sebi
Freshman
Freshman
 
Posts: 3
Joined: Sun Jan 06, 2008 11:00 am

Postby puyopuy » Sun Feb 17, 2008 5:54 am

Hello guys,

After I updated to m5-rc14, SMS ReceiveIntent not working any more. I changed android:value to android:name from AndroidManufest.xml.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.         <receiver class=".SMSReceiver">
  3.  
  4.             <intent-filter>
  5.  
  6.                 <action android:name="android.provider.Telephony.SMS_RECEIVED" />
  7.  
  8.             </intent-filter>
  9.  
  10.         </receiver>
  11.  
  12.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


Put a break point in onReceiveIntent but nothing happen . Any idea what's wrong?

Thanks
puyopuy
puyopuy
Junior Developer
Junior Developer
 
Posts: 17
Joined: Sun Feb 03, 2008 4:46 am

Postby plusminus » Sun Feb 17, 2008 1:02 pm

Hello puyopuy,

you also have to change:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.         <receiver class=".SMSReceiver">
  2.  
  3. <!-- Change to -->
  4.  
  5.         <receiver android:name=".SMSReceiver">
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


Your project should not have compiled with the code you wrote.

(untested)

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby puyopuy » Sun Feb 17, 2008 2:31 pm

Sorry, I must paste the old source code. My actual code already changed and I can compile and running in the emulator.

I also realized I cannot select SMS_RECEIVED from the action attributes drop down. Please see my attached image.

Best Regards,
Puyopuy
Attachments
attributes.JPG
No SMS_RECEIVED attribute
attributes.JPG (48.97 KiB) Viewed 12891 times
puyopuy
Junior Developer
Junior Developer
 
Posts: 17
Joined: Sun Feb 03, 2008 4:46 am

Top
PreviousNext

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 4 guests