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 6233685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:20:42+00:00 2026-05-24T10:20:42+00:00

I am trying to create an SMS broadcast receiver that will execute whenever a

  • 0

I am trying to create an SMS broadcast receiver that will execute whenever a text message comes in. I have seen a lot of tutorials on this but I am receiving a curious error to the effect of “Permission Denial”.

Googling this particular error seems to indicate that I do not have the proper uses-permission tag in my manifest, but I do! Here is my manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.icemanind.simpletext" android:versionCode="1"
    android:versionName="1.0">
    <uses-sdk android:minSdkVersion="8" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <uses-permission android:name="android.permission.INTERNET" />

    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".MainWindow" android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
         <receiver android:name=".SMSBroadcastReceiver" android:enabled="true" android:permission="android.permission.RECEIVE_SMS">
            <intent-filter>
                <action android:name="android.provider.Telephony.SMS_RECEIVED"></action>
            </intent-filter>
        </receiver>
    </application>
</manifest>

Here is the java code for the class:

public class SMSBroadcastReceiver extends BroadcastReceiver {
    private static final String SMS_RECEIVED = "android.provider.Telephony.SMS_RECEIVED";
    private static final String TAG = "SMSBroadcastReceiver";

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.i(TAG, "Intent recieved: " + intent.getAction());

        if (intent.getAction() == SMS_RECEIVED) {
            Bundle bundle = intent.getExtras();
            if (bundle != null) {
                Object[] pdus = (Object[]) bundle.get("pdus");
                final SmsMessage[] messages = new SmsMessage[pdus.length];
                for (int i = 0; i < pdus.length; i++) {
                    messages[i] = SmsMessage.createFromPdu((byte[]) pdus[i]);
                }
                if (messages.length > -1) {
                    Log.i(TAG,
                            "Message recieved: " + messages[0].getMessageBody());
                }
            }
        }
    }
}

Here is the LogCat output I am receiving:

D/dalvikvm(  299): GC_EXPLICIT freed 156 objects / 11488 bytes in 144ms
D/dalvikvm(  308): GC_EXPLICIT freed 46 objects / 2176 bytes in 141ms
D/dalvikvm(  169): GC_EXPLICIT freed 642 objects / 36104 bytes in 153ms
W/ActivityManager(   64): Permission Denial: broadcasting Intent { act=android.provider.Telephony.SMS_RECEIVED (hasextras) } from com.android.phone (pid=132, uid=1001) requires android.permission.RECEIVE_SMS due to receiver com.icemanind.simpletext/com.icemanind.simpletext.SMSBroadcastReceiver
V/Telephony(  250): getOrCreateThreadId uri: content://mms-sms/threadID?recipient=6025099968
V/Telephony(  250): getOrCreateThreadId cursor cnt: 1
D/Mms:app (  250): getSmsNewMessageNotificationInfo: count=6, first addr=6025099968, thread_id=1

As you can see, it is receiving the text and attempting to pass it onto my broad cast receiver, but gets that “Permission Denial” error. Any help would be appreciated. This is driving me crazy

  • 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-05-24T10:20:43+00:00Added an answer on May 24, 2026 at 10:20 am

    Okay, for anyone else having this issue, I found my problem. I had to change this line:

    if (intent.getAction() == SMS_RECEIVED) {
    

    to:

    if (intent.getAction().equals(SMS_RECEIVED)) {
    

    A Java equality issue apparently on my end.

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

Sidebar

Related Questions

I am trying create a WCF service that leverages the WPF MediaPlayer on the
Trying to create my first iPhone app that would play back audio. When I
Trying to create a small monitor application that displays current internet usage as percentage
Trying to create an framework 4.0 WCF basicHttp service hosted by IIS (6) that
Im trying to create a mixing for Ext.grid.Panel components. This is how I have
Trying to create a QtRuby application, I get the following error: /usr/lib64/ruby/site_ruby/1.8/Qt/qtruby4.rb:2144: [BUG] Segmentation
Trying to create a user account in a test. But getting a Object reference
Trying to create several layers of folders at once C:\pie\applepie\recipies\ without using several different
Trying to create a list to return some JSON data to a view. Following
I'm trying to create a bookmarklet for posting del.icio.us bookmarks to a separate account.

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.