I'm downloading the Android app from the server using the When two apps are downloaded at the same time, only one notification is displayed-another notification- I Why am I missing one? Because you have the same ID i.e. '0' in your case , And the document says, it should be unique every time. I think you should give different numbers every time to 0. What is the documentation given below .. A notification should appear in the post status bar If an alert with the same ID has already been posted by your application and has not yet been canceled, then update it Information will be replaced by the information provided. DownloadManEgr class. A broadcast receiver has been registered upon completion of the download. Information is displayed once, when
gets DownloadManager.ACTION_DOWNLOAD_COMPLETE intent. In order to set up the app, the notification should be clicarded. 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 Package in / sdcard / Downlaod Path .setDestinationInExternalPublicDir (Environmental. DIRECTORY_DOWNLOADS, MY_PATH); Long enque = DM.exe (rake); Register Receiver (Receiver, New Intent Filter (0 download Dinner. Action_DOWNLOAD_COMPLETE)); Broadcast Receiver Receiver = New Broadcast Receiver () {@ Override Public Records on Receive (Context Reference, Intent of Intent) {String Action = Intent.Tetection (); If (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals (verb)) {int id = 0; Query query = new query (); Query.setFilterById (queue); 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 Notification Manager Information Manager = (Information Manager) this.getSystemService (context.NOTIFICATION_SERVICE); Notification Notification = New Notification (Arrayable.Con, "", System Syrtetime Millis ()); Notification.flags | = Notice FLAG_AUTO_CANCEL; Notification.flags | = Notice FLAG_NO_CLEAR; Intent I = new intent (Intent.ACTION_VIEW); // When the notification is clicked, install the app. IsetDataAndType (the new file (Environmental .getExternalStorage directory (+ + APP_PATH)), "pending / pending pending vertical positional = pending.activity (activity, 0, I, 0); Notification.SetlatestEventInfo (activity, MY_TEXT, MY_TEXT, pending); Information number + = 1; Information manager. Information (ID ++, notification);}}}
< Code> Notification Manager Information (0, Notification);
Public Notification (Int ID, Notification Notification )
Comments
Post a Comment