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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:01:22+00:00 2026-05-23T20:01:22+00:00

I am trying to get all installed applications using intents and broadcast receiver ,

  • 0

I am trying to get all installed applications using intents and broadcast receiver, but the problem is I never directs to my onReceive method and so not getting any package name. I am using the following code:

KillAppBCR.java

public class KillAppBCR extends Activity {
private static final String TAG = "BroadcastReceiver";

BroadcastReceiver receiver;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);

    receiver = new TestBroadcastReceiver();

    registerReceiver(receiver, filter);

    Log.e(TAG, "onCreate");
    Toast.makeText(KillAppBCR.this,"onCreate",Toast.LENGTH_SHORT).show();

}

TestBroadcastReceiver.java

public class TestBroadcastReceiver extends BroadcastReceiver
 {
 private static final String TAG = "TestBroadcastReceiver";

@Override
public void onReceive(Context context, Intent intent)
{
    String actionStr = intent.getAction();

    Log.e(TAG, "onReceive");
     Toast.makeText(context,"onReceive",Toast.LENGTH_SHORT).show();


    if (Intent.ACTION_PACKAGE_ADDED.equals(actionStr)) {

        Uri data = intent.getData();

    }
}
} 

AndroidManifest.xml

 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.KillAppBCR"
  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=".KillAppBCR"
              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=".TestBroadcastReceiver">
  <intent-filter>
    <action android:name="com.KillAppBCR" />
  </intent-filter>
</receiver>
</application>
</manifest>

Log Cat

07-19 18:39:48.768: ERROR/BroadcastReceiver(512): CC

07-19 18:39:49.008: INFO/ActivityManager(58): Displayed activity    com.KillAppBCR/.KillAppBCR: 685 ms (total 685 ms)

07-19 18:39:54.338: DEBUG/dalvikvm(121): GC_EXPLICIT freed 259 objects / 12032 bytes in 157ms

07-19 18:42:58.943: DEBUG/SntpClient(58): request time failed: java.net.SocketException: Address family not supported by protocol

07-19 18:47:58.989: DEBUG/SntpClient(58): request time failed: java.net.SocketException: Address family not supported by protocol

Where is the problem ? Please help me out, I want to receive broadcasts of all installed apps.

Thanks

  • 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-23T20:01:23+00:00Added an answer on May 23, 2026 at 8:01 pm

    Why your Activity code most probably doesn’t work: You’re registering the receiver only temporarily with registerReceiver. So Android will kill your receiver again after you closed your Activity.

    What you have to do is replace com.KillAppBCR with android.intent.action.PACKAGE_ADDED in your AndroidManifest.xml. This tells Android to register your receiver permanently.

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

Sidebar

Related Questions

I've been trying to install Shoulda script/plugin install git://github.com/thoughtbot/shoulda.git but all I get is:
I am trying to get all the rows that exist in allData but not
Hello I started trying to develop Android applications today, but I have a problem:
I was trying to get spork installed on my ROR application. Using Git, I
iam trying to get all object's xpath's from loaded page via selenium something similar
I'm trying to get all the direct reports of a User through Active Directory,
I'm trying to get all property names / values from an Outlook item. I
I'm trying to get all controls in a winform disabled at the Load event.
I'm trying to get all the input elements from a certain form from jQuery
I am trying to get all users that are updated maximum 90 seconds ago:

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.