sms storage in database in android

18 views
Skip to first unread message

Nitee Shah

unread,
Mar 1, 2012, 6:27:55 AM3/1/12
to Pune-GTUG, deshpan...@gmail.com, shruti...@gmail.com, kothari...@gmail.com
Hello,

I am trying to block a SMS. I am able to block message but not able to
store that blocked SMS in database from a broadcastReceiver. Inserting
a record from service is not working. Is there any way?? I wrote
DBHelper and DAO classes for it.

Thanks and Regards,
Nitee Shah

Chetan D

unread,
Mar 3, 2012, 7:21:58 AM3/3/12
to pune...@googlegroups.com
Write a separate thread for it.
Don't access DB from service.


--
Visit our Blog at http://pune-gtug.blogspot.com for discussions, articles and videos.
Disclaimer - Please note Pune-GTUG is an independent group and opinions mentioned here are of individuals alone and in no way related to "Google", the corporation.
-------------------------------------------------------------------------------------------------------------------------

You received this message because you are subscribed to the Google Groups "Pune-GTUG" group.
 To post to this group, send email to pune...@googlegroups.com
 To unsubscribe from this group, send email to pune-gtug-...@googlegroups.com
 For more options, visit this group at http://groups.google.co.in/group/pune-gtug?hl=en-GB

jay w

unread,
Mar 3, 2012, 7:53:31 AM3/3/12
to pune...@googlegroups.com
Android Docs say,

A Service runs in the main thread of its hosting process—the service does not create its own thread and doesnot run in a separate process (unless you specify otherwise). 

So it is going to block the main thread of the application which started it.
I have a simple advice for you, use IntentService for doing n/w IO, file IO or other
CPU intensive or time consuming operations. 
IntentService is a subclass of Service and provides added benefits.

  Good things about IntentService:
  1. It runs in its own thread, so you dont have to implement any threading.
  2. It stops itself once the work is finished.
--
Thanks & Regards
------------------------------
Jaydeep
Software Engineer
IntouchId : *2010-1111-1111
Twitter : @jaydeep_w

Blog: The4thDimension

------------------------------

Reply all
Reply to author
Forward
0 new messages