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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:26:54+00:00 2026-05-25T01:26:54+00:00

I have some trouble while try using broadcast receiver. Target: I have three app

  • 0

I have some trouble while try using broadcast receiver.

Target:
I have three app which will work next schema
1. First – is broadcast receiver app which will write some data to database when it will get a message.
2. Second – is app android which will send some intent with data which must be saved in database.
3. Third – is widget in home screen which will also send some intent with data which must be saved in database.

So, I make three app on eclipse.
1. BroadcastReceiverExample – broadcast receiver it has next files

package com.test.receive;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

public class SimpleReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        Toast.makeText(context, "service get started action", Toast.LENGTH_LONG).show();
        Log.e("START","START");

    }

}

and the manifest file source

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.test"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="7" />

    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <receiver android:enabled="true" android:name=".receive.SimpleReceiver" android:exported="false">
            <intent-filter android:priority="999">
                <action android:name="com.test.SIMPLE_TEST_SERVICE"></action>
            </intent-filter>
        </receiver>

    </application>
</manifest>

also I create App project (BroadcastSenderExample) in Eclipse
and it has file with next sender code

package com.test.sender;

import com.test.R;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class BroadcastSenderExample extends Activity {

    public final static String ACTION="com.test.SIMPLE_TEST_SERVICE";
    public final static String TYPE="type";
    public final static int START=1;
    public final static int STOP=0;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        btnStart=(Button)findViewById(R.id.btnStart);
        btnStart.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                Intent bcIntent=new Intent(ACTION);
                sendBroadcast(bcIntent);
            }
        });
        btnEnd=(Button)findViewById(R.id.btnEnd);
        btnEnd.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                Intent bcIntent=new Intent(ACTION);
                sendBroadcast(bcIntent);
            }
        });
    }

    private Button btnStart=null;
    private Button btnEnd=null;

}

Then I install first app on device (and emulator try too), and install second app.
And then second app run intent call nothing happen.

What am I doing wrong?

I make two projects with next code

Project one wBRReceiver

File WBRReceiver.java

package com.x.brreceiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

public class WBRReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context arg0, Intent arg1) {
        Log.i("THIS IS A TEST RECEIVER","THIS IS A TEST RECEIVER");
        Toast.makeText(arg0, "this is a test receiver", Toast.LENGTH_LONG).show();
    }

}

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.x.brreceiver"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="8" />

    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <receiver android:name="WBRReceiver">
            <intent-filter>
                <action android:name="com.x.START"></action>
            </intent-filter>
        </receiver>

    </application>
</manifest>

And project two wBRSender

File WBRSenderActivity.java

package com.x.brsender;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class WBRSenderActivity extends Activity {

    private String ACTION_NAME="com.x.START";

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Intent brr=new Intent(ACTION_NAME);
        //I can't use this
        //brr.setClass(this, WBRReceiver.class);
        //Because i just don't have this class in this case
        sendBroadcast(brr);
    }
}

And manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.x.brsender"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="8" />

    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".WBRSenderActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
</manifest>

And then I install first app onto emulator, and then run second app. And it works.

  • 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-25T01:26:55+00:00Added an answer on May 25, 2026 at 1:26 am

    Did you look at the logcat output? There’s a very good chance it tells you exactly what’s wrong.

    Without staring at your code too much, it seems that your manifest is broken. In your receiver, you state the android:name is “.receive.SimpleReceiver”… this value (when starting with a .) is not simply “the part that follows the Android package name) — though it works out that way most of the time. In your case, your Android package is “com.test” however the package containing your receiver is “com.test.receive.SimpleReceiver” and its Java package is “com.test.receive”. Try changing your android:name to “com.test.receive.SimpleReceiver”.

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

Sidebar

Related Questions

I am developing a small windows app, but have some trouble deciding whether to
I am having trouble while using the YUI panel as a dialog. I have
I have some trouble using Tomcat Client Deployer (TCD) with a local Tomcat installation.
I'm having some trouble with databinding inside a UserControl when using an ItemsControl which
I have some trouble with my trac installation (version 11.4). What should I do
I have some trouble with jquery ui-events: In my application, there are some sliders.
I have some trouble achieving adequate real-time performance from my application and wondering if
I'm have some trouble with the fulltext CONTAINS operator. Here's a quick script to
I am mlearning javascript and have some trouble creating an onject via prototype. I
I'm migrating to Nhibernate 2.0 GA but have some trouble with setting cache expirations

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.