Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9101631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:10:49+00:00 2026-06-17T01:10:49+00:00

I have created a BroadcastReceiver, which actualy handles incoming SMS. this is code running

  • 0

I have created a BroadcastReceiver, which actualy handles incoming SMS. this is code running fine in android 2.3.3 but somehow am not able to run the same code on devices running ICS.

My Receiver

public class SmsListener extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO Auto-generated method stub
        System.out.println("#### SMS Received");
        if(intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED")){
            Bundle bundle = intent.getExtras();           //---get the SMS message passed in---
            SmsMessage[] msgs = null;
            String msg_from;
            if (bundle != null){
                //---retrieve the SMS message received---
                try{
                    Object[] pdus = (Object[]) bundle.get("pdus");
                    msgs = new SmsMessage[pdus.length];
                    for(int i=0; i<msgs.length; i++){
                        msgs[i] = SmsMessage.createFromPdu((byte[])pdus[i]);
                        msg_from = msgs[i].getOriginatingAddress();
                        String msgBody = msgs[i].getMessageBody();
                        System.out.println("#### SMS Received: " + msg_from);
                        System.out.println("#### Message: " + msgBody);
                    }
                }catch(Exception e){
                           Log.d("Exception caught",e.getMessage());
                }
            }
        }
    }
}

Permissions

   <receiver android:name=".SmsListener" android:enabled="true"       android:permission="android.permission.RECEIVE_SMS">
      <intent-filter>
         <action android:name="android.provider.Telephony.SMS_RECEIVED" />
      </intent-filter>
   </receiver>    

<uses-permission android:name="android.permission.RECEIVE_SMS" /> 
<uses-permission android:name="android.permission.READ_SMS"/>       
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T01:10:51+00:00Added an answer on June 17, 2026 at 1:10 am

    Actually i got the answer, with the latest security additions now android permits registration of a broadcast receiver only through a visible activity.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a long running service which responds to multiple BroadcastReceivers (created in code,
I have created a service running in background which saves gps points on the
What I want to do, have a [BroadcastReceiver] that listens to any incoming SMS,
I have created an Android status bar notification with a custom layout which contains
I have created a JSP / servlets application running in Tomcat 7. It runs
I have created an android application that calls (using kSOAP library) a SOAP based
I created a BroadcastReceiver which is constructed from a Service. The BroadcastReceiver needs to
I have created a class to manage a SQLite database. Part of its code
I have a program that monitors incoming SMS's, and I want it to monitor
I have a BroadcastReceiver that listen for the SMS_SENT Intent after an SMS has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.