i want to make an application in which i start service which start broadcast reciever for sms_read and every time when new sms come and reciever detact that message. no matter app is running or not.
Asked
Active
Viewed 80 times
-2
-
you don't need a service for that. What you need is to register a receiver, and do this on every device boot. – Vladyslav Matviienko Dec 13 '16 at 10:46
-
is it work after app kill? – Julia Williams Dec 13 '16 at 10:49
1 Answers
0
you don't have to use a Service for Reading and listening for SMS.
All you need to Do is just register a Broadcast receiver in your Application like this .
<receiver android:name=".IncomingSms" >
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
And just write whatever functionality you have to do upon receiving the SMS in the Broadcast receiver by starting an IntentService or a Thread

Hasif Seyd
- 1,686
- 12
- 19