GrandeBg 2020-06-02 20:08 采纳率: 0%
浏览 175

求大神相助,仿MIUI、微信来电通知无法解决通知折叠到通知列表

求相助,希望有大神帮我解决下,我想做一个类似小米来电的通知功能,我发现小米的来电通知不会自动折叠到通知列表,而我无论如何设置,我的通知都会折叠通知列表里,求助解决方案

如图:来电通知并不会折叠到下拉通知列表

图片说明

我的通知部分代码:

    public static void buildCallNotification(Service service, final PendingIntent resultPendingIntent) {
        Log.d(TAG,"buildCallNotification");
        NotificationCompat.Builder builder;
        if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            builder = new NotificationCompat.Builder(service, NotificationChannelsUtils.CALL_CHANNEL);
        } else {
            builder = new NotificationCompat.Builder(service);
        }
        builder.setSmallIcon(getSmallIconResId())
                .setContentTitle(service.getResources().getText(R.string.channel_call))
                .setCategory(NotificationCompat.CATEGORY_CALL)
                .setContentIntent(resultPendingIntent)
                .setTicker(service.getResources().getText(R.string.channel_call))
                .setFullScreenIntent(resultPendingIntent,true)
                .setPriority(NotificationCompat.PRIORITY_MAX)
                .setOngoing(true);

        Notification notification = builder.build();
        service.startForeground(NOTIFICATION_ID_INCOMINGCALL, notification);
    }

渠道部分代码:

    @RequiresApi(api = Build.VERSION_CODES.O)
    private static NotificationChannel getCallChannel(Context context){
        NotificationChannel notificationChannel = new NotificationChannel(CALL_CHANNEL, context.getString(R.string.channel_call), NotificationManager.IMPORTANCE_HIGH);
        notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
        notificationChannel.setSound(null, null);
        notificationChannel.setImportance(NotificationManager.IMPORTANCE_HIGH);
        return notificationChannel;
    }
  • 写回答

1条回答

  • dabocaiqq 2020-06-05 15:30
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 本题的答案是不是有问题
  • ¥15 关于#r语言#的问题:(svydesign)为什么在一个大的数据集中抽取了一个小数据集
  • ¥15 C++使用Gunplot
  • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?
  • ¥15 蓝桥杯单片机第十三届第一场,整点继电器吸合,5s后断开出现了问题
  • ¥15 file converter 转换格式失败 报错 Error marking filters as finished,如何解决?
  • ¥15 Arcgis相交分析无法绘制一个或多个图形