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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:04:52+00:00 2026-06-07T06:04:52+00:00

I am downloading an Android app from the server using the DownloadManaegr class. A

  • 0

I am downloading an Android app from the server using the DownloadManaegr class. A broadcast receiver is registered when the download is completed. When the DownloadManager.ACTION_DOWNLOAD_COMPLETE intent is received, a bar notification is displayed. To install the app, the notification should be cliccked. This is what I am doing:

    DownloadManager dm = (DownloadManager) DownloadApplicationActivity.this.getSystemService(Context.DOWNLOAD_SERVICE);
    DownloadManager.Request req = new DownloadManager.Request(Uri.parse(MY_LINK));
    req.setTitle(MY_TITLE)
                    .setDescription("Downloading ....")
                    // download the package to the /sdcard/downlaod path.
                    .setDestinationInExternalPublicDir(
                            Environment.DIRECTORY_DOWNLOADS,
                            MY_PATH);
            long enqueue = dm.enqueue(req);
    registerReceiver(receiver, new IntentFilter(0DownloadManager.ACTION_DOWNLOAD_COMPLETE));        

    BroadcastReceiver receiver= new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) {
int id = 0;
            Query query = new Query();
            query.setFilterById(enqueue);
            Cursor c =dm.query(query);
            if (c.moveToFirst()) {
                int columnIndex = c.getColumnIndex(DownloadManager.COLUMN_STATUS);
                if (DownloadManager.STATUS_SUCCESSFUL == c.getInt(columnIndex)) {
                    // show a notification bar.
                    NotificationManager notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
                    Notification notification = new Notification(R.drawable.icon,"",System.currentTimeMillis());

                    notification.flags |= Notification.FLAG_AUTO_CANCEL;
                    notification.flags |= Notification.FLAG_NO_CLEAR;
                    Intent i = new Intent(Intent.ACTION_VIEW);
                    // when the notification is clicked, install the app.
                            i.setDataAndType(Uri.fromFile(new File(Environment
                                    .getExternalStorageDirectory() + APP_PATH)),"application/vnd.android.package-archive");
                            PendingIntent pendingIntent = PendingIntent.getActivity(
                                    activity, 0, i, 0);
                            notification.setLatestEventInfo(activity, MY_TEXT, MY_TEXT,pendingIntent);
                            notification.number += 1;
                            notificationManager.notify(id++, notification);
                   }
            }           
    }; 

When two apps are downloaded at the same time, only one notification is displayed -the second notification-. I am missing the first one. 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-07T06:04:53+00:00Added an answer on June 7, 2026 at 6:04 am

    because you are calling notify with same id i.e ‘0’ in your case, and the docs says it should be unique every time.

    I think you should give different number everytime in place of 0.

    notificationManager.notify( 0, notification);
    

    below is what document says..

    public void notify (int id, Notification notification)
    

    Posts a notification to be shown in the status bar. If a notification with the same id has already been posted by your application and has not yet been canceled, it will be replaced by the updated information.

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

Sidebar

Related Questions

I'm using an API in my Android app that downloads images from the web
From my android app, I'm downloading an apk from the web, storing it in
My goal is to download images from a google app engine server with my
I'm having trouble downloading the Licence Verification Library from the android SDK manager. It's
I am downloading a CSV file from another server as a data feed from
My program is downloading data from a server, once he received all the data,
I'm trying to Downloading pdf from server and displaying it as it is. I
I am working on an Android app that uses the gdata-java-client to download documents
I'm using ProgressDialog to prevent the user from interacting while the device is downloading
I am writing an app that will be downloading user's documents from a remote

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.