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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:12:40+00:00 2026-06-14T09:12:40+00:00

I’m writing a simple code launch a broadcast receiver when I receive a message.

  • 0

I’m writing a simple code launch a broadcast receiver when I receive a message. But I get a force close error. I’ve added the required permissions in the AndroidManifest.xml . I took the code for BroadcastReceiever from this site(http://www.androidcompetencycenter.com/2008/12/android-api-sms-handling/). Please show me where I’m going wrong. Here is my code:

package com.example.findme;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsMessage;
import android.widget.Toast;



public class SMSReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        Bundle bundle = intent.getExtras();

        Object messages[] = (Object[]) bundle.get("pdus");
        SmsMessage smsMessage[] = new SmsMessage[messages.length];
        for (int n = 0; n < messages.length; n++) {
            smsMessage[n] = SmsMessage.createFromPdu((byte[]) messages[n]);*/
        Toast.makeText(context,"Reveived!",1).show();
        }

        // show first message
       Toast toast = Toast.makeText(context, "Received SMS: " + smsMessage[0].getMessageBody(), Toast.LENGTH_LONG);
        toast.show();
    }

Here is the logCat:

11-09 21:05:03.190: D/AndroidRuntime(446): Shutting down VM
11-09 21:05:03.190: W/dalvikvm(446): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
11-09 21:05:03.230: E/AndroidRuntime(446): FATAL EXCEPTION: main
11-09 21:05:03.230: E/AndroidRuntime(446): java.lang.RuntimeException: Unable to instantiate receiver com.example.smsmanager1.receiver.SMSReceiver: java.lang.ClassNotFoundException: com.example.smsmanager1.receiver.SMSReceiver in loader dalvik.system.PathClassLoader[/data/app/com.example.smsmanager1-1.apk]
11-09 21:05:03.230: E/AndroidRuntime(446):  at android.app.ActivityThread.handleReceiver(ActivityThread.java:2789)
11-09 21:05:03.230: E/AndroidRuntime(446):  at android.app.ActivityThread.access$3200(ActivityThread.java:125)
11-09 21:05:03.230: E/AndroidRuntime(446):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2083)
11-09 21:05:03.230: E/AndroidRuntime(446):  at android.os.Handler.dispatchMessage(Handler.java:99)
11-09 21:05:03.230: E/AndroidRuntime(446):  at android.os.Looper.loop(Looper.java:123)
11-09 21:05:03.230: E/AndroidRuntime(446):  at android.app.ActivityThread.main(ActivityThread.java:4627)
11-09 21:05:03.230: E/AndroidRuntime(446):  at java.lang.reflect.Method.invokeNative(Native Method)
11-09 21:05:03.230: E/AndroidRuntime(446):  at java.lang.reflect.Method.invoke(Method.java:521)
11-09 21:05:03.230: E/AndroidRuntime(446):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-09 21:05:03.230: E/AndroidRuntime(446):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-09 21:05:03.230: E/AndroidRuntime(446):  at dalvik.system.NativeStart.main(Native Method)
11-09 21:05:03.230: E/AndroidRuntime(446): Caused by: java.lang.ClassNotFoundException: com.example.smsmanager1.receiver.SMSReceiver in loader dalvik.system.PathClassLoader[/data/app/com.example.smsmanager1-1.apk]
11-09 21:05:03.230: E/AndroidRuntime(446):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
11-09 21:05:03.230: E/AndroidRuntime(446):  at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
11-09 21:05:03.230: E/AndroidRuntime(446):  at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
11-09 21:05:03.230: E/AndroidRuntime(446):  at android.app.ActivityThread.handleReceiver(ActivityThread.java:2780)
11-09 21:05:03.230: E/AndroidRuntime(446):  ... 10 more
11-09 21:05:13.211: I/Process(446): Sending signal. PID: 446 SIG: 9
  • 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-14T09:12:41+00:00Added an answer on June 14, 2026 at 9:12 am

    The class’ fullname is incorrect in the declaration of the receiver.

    In your manifest file, you must replace

    com.example.smsmanager1.receiver.SMSReceiver
    

    by

    com.example.findme.SMSReceiver
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.