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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:40:08+00:00 2026-06-04T14:40:08+00:00

My application that is not on Play Store verify on the web If there

  • 0

My application that is not on Play Store verify on the web If there are a new version and download and start it. After the installation I would like to restart the application and I would use a BroadcastRecevier with ACTION_PACKAGE_REPLACED. This is the code :

Broadcast:

public void onReceive(Context context, Intent intent) {
  if(intent.getAction().equals(Intent.ACTION_PACKAGE_REPLACED)){
    ApplicationInfo app = new ApplicationInfo();
    if(app.packageName.equals("it.android.downloadapk")){
      Intent LaunchIntent = context.getPackageManager().getLaunchIntentForPackage(app.packageName);
      context.startActivity(LaunchIntent);                    
    }
  }
}

Manifest:

<receiver android:name="it.android.downloadapk.Broadcast">
  <intent-filter>
    <action android:name="android.intent.action.ACTION_PACKAGE_REPLACED"></action>
    <data android:scheme="package" android:path="it.android.downloadapk" /> 
  </intent-filter>
</receiver>

The problem is that when I install new apk, the Broadcast appears not to start, why ?

  • 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-04T14:40:09+00:00Added an answer on June 4, 2026 at 2:40 pm

    see this:

    How to know my Android application has been upgraded in order to reset an alarm?

    correct fix is that you use the wrong string in the manifest:
    http://developer.android.com/reference/android/content/Intent.html#ACTION_PACKAGE_REPLACED

    it should be “android.intent.action.PACKAGE_REPLACED” instead.


    ok , i see that what i’ve written is still not enough to try it out, so i will make an exception and publish a whole project just to show that it works:
    app code is in a package called “com.broadcast_receiver_test” .
    don’t forget to run it before testing , or else it won’t work on some android versions (i think API 11+) .

    manifest:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.broadcast_receiver_test" android:versionCode="1"
      android:versionName="1.0">
      <uses-sdk android:minSdkVersion="3" />
    
      <application android:icon="@drawable/ic_launcher"
        android:label="@string/app_name">
    
        <activity android:name=".BroadcastReceiverTestActivity"
          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=".MyBroadcastReceiver">
          <intent-filter>
            <action android:name="android.intent.action.PACKAGE_REPLACED"/>
            <data android:scheme="package"  />
          </intent-filter>
    
          <intent-filter>
            <action android:name="android.intent.action.PACKAGE_REMOVED"/>
            <data android:scheme="package"  />
          </intent-filter>
    
          <intent-filter>
            <action android:name="android.intent.action.PACKAGE_ADDED"/>
            <data android:scheme="package"  />
          </intent-filter>
        </receiver>
    
      </application>
    </manifest>
    

    MyBroadcastReceiver.java:

    public class MyBroadcastReceiver extends BroadcastReceiver
      {
      @Override
      public void onReceive(final Context context,final Intent intent)
        {
        final String msg="intent:"+intent+" action:"+intent.getAction();
        Log.d("DEBUG",msg);
        Toast.makeText(context,msg,Toast.LENGTH_SHORT).show();
        }
      }
    

    please just run it and see that it works perfectly .


    EDIT: if your app is for API12 and above, and only wish to handle the case of updating of your app, you can use this intent alone:

    http://developer.android.com/reference/android/content/Intent.html#ACTION_MY_PACKAGE_REPLACED

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

Sidebar

Related Questions

I have a node application that is not a web application - it completes
I have read that viewstate is not there in asp.net MVC application. I am
I have play-framework application that uses one module which I've created by play new-module
I have a .net application that is not working on a colleagues computer (he
We have a bug in our application that does not occur every time and
I have just been involved in writing an application that does not use Doctype's
I'm interesting in gathering usage metrics for an application that I did not write
I am currently implementing the application that displays hierarchy using ListBoxes (please do not
I'm referring to the camera application that is already installed on my G1, not
I want to create an application that doesn't use Portrait mode. I am not

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.