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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:51:11+00:00 2026-05-25T15:51:11+00:00

I am trying to detect when a new App is being installed but only

  • 0

I am trying to detect when a new App is being installed but only if my app is running. I managed to detect the installation of the app by making a BroadcastReceiver and activating it inside the AndroidManifest file but this will detect even if my app is closed.
So that is why I need to manually activate and deactivate the broadcastreveiver. To do this I have this code:

br = new BroadcastReceiver() {

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO Auto-generated method stub
        Log.i("Enter", "Enters here");
        Toast.makeText(context, "App Installed!!!!.", Toast.LENGTH_LONG).show();
    }
};
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
intentFilter.addAction(Intent.ACTION_PACKAGE_INSTALL);
registerReceiver(br, intentFilter);

This should make a toast when a new app is installed. But sadly it does not. It does not enter in the onReceive method. Any help is appreciated.

  • 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-25T15:51:12+00:00Added an answer on May 25, 2026 at 3:51 pm

    I tried to register the BroadcastReceiver in either manifest file or java code. But both of these two methods failed to trigger the onReceive() method.
    After googling this problem, I found a solution for both methods from another Thread in SO:
    Android Notification App

    In the manifest file (this approach no longer applies since API 26 (Android 8), it was causing performance issues on earlier Android versions):

    <receiver android:name=".YourReceiver">
        <intent-filter>
            <action android:name="android.intent.action.PACKAGE_INSTALL" />
            <action android:name="android.intent.action.PACKAGE_ADDED" />
            <data android:scheme="package"/>
        </intent-filter>
    </receiver>
    

    In java code:

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
    intentFilter.addAction(Intent.ACTION_PACKAGE_INSTALL);
    intentFilter.addDataScheme("package");
    registerReceiver(br, intentFilter);
    

    This should work for you.

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

Sidebar

Related Questions

I'm new to Java and RMI, but I'm trying to write my app in
I'm trying to detect any touch on the iPhone's UIStatusBar but its not working.
I'm trying to auto-detect if the selection of a textarea contains new lines, or
I'm trying to detect whether a string holds a dash but nothing seems to
I have an app in which I'm trying to detect WHEN the Internet connection
I am very new to Python and I have been trying to detect missing
I'm trying to detect when the browser has stopped being resized. The following works,
Trying to detect if new elements are added or removed from the DOM in
I'm trying to detect memory leaks by globally overloading new and delete for debug
Trying to detect when a user clicks Cancel but the $_POST on using var_export($_POST)

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.