通知位置更新时更改

时间:2016-02-07 08:39:52

标签: android notifications android-notifications builder

我遇到错误,每当我更新通知时,它会将我的通知置于顶部,然后来自其他应用程序的通知首先出现,当我的通知再次更新(每1秒)时,我的通知再次出现在上面,这会继续。 我想更新我的通知而不是一直放在首位。

    @Override
    public void onDownloadProgress(String taskId, final int size,String progress_String,int status,String filename,int type)
       {
             if(mBuilder == null || mNotifyManager == null){
                 mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
                mBuilder = new NotificationCompat.Builder(context);
                mBuilder.setContentTitle(""+filename);
                 if(type == TYPE_AUDIO){
                    mBuilder.setSmallIcon(R.drawable.audio_icon);
                }else{
                    mBuilder.setSmallIcon(R.drawable.vide_icon);
                 }
                mBuilder.setSound(null)
               .setVibrate(new long[0]);

             }


                i.putExtra(CODE_PROGRESS, "-> "+size+"%"+progress_String);
                  Preference_Manager.set_To_String_List_To_Shared_Preferences(context, ids.indexOf(taskId), "-> "+size+"%"+progress_String, DOWNLOAD_LIST_PROGRESS);
                mBuilder.setProgress(100, size, false);
            mBuilder.setContentText("-> "+size+" %"+progress_String);
                mNotifyManager.notify(taskId.hashCode(), mBuilder.build());

        }

0 个答案:

没有答案