tuenti / SmsRadar

Android library created to listen incoming and outgoing SMS's
Apache License 2.0
393 stars 116 forks source link

Start the service on every message sent #4

Closed giwrgos88 closed 9 years ago

giwrgos88 commented 9 years ago

How i can start the service every time a message has been send from the default sms app?

Thank you

pedrovgs commented 9 years ago

This library should be linked to the Android component lifecycle you are going to use, usually you should initialize SmsRadar when your application object starts, to know when one sms has been sent or received. If you don't start your service you are not going to be notified about incoming or outgoing sms.

giwrgos88 commented 9 years ago

yes i know that, but the service is only working when the application is open, if you close the application the service doesn't work any more so any message that i have sent or received doesn't show it them

pedrovgs commented 9 years ago

That's not implemented in SMS Radar because library clients can use this library without keep the application started even if the user kills the app. If you want to do that you'll have to implement that functionality yourself, you can use a service or intent service and start SmsRadar from that service.

giwrgos88 commented 9 years ago

or i can use the BroadcastReceiver to start the smsradar on the receive, is that right?

pedrovgs commented 9 years ago

If you do that, you are going to start sms radar just once your receiver be notified. I don't know what do you have to implement, but that could work :)