I have a SmsReceiver class that I want to register in the main activity, what exactly should I do ?
I am new to Android.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Either you can do 2 things:
BroadcastReceiverin theManifestBroadcastReceiverin code.For option 2 (which you are asking):
Create a
BroadcastReceiverin code (MyBroadcastReceiver).Declare MyBroadcastReceiver in the scope of your
Activity:Register the
BroadcastReceiverin yourActivityby: