我们遇到了在 Redmi note 6 pro 和 Redmi note 8 pro 设备中未显示呼叫通知弹出的问题

问题描述

我们已经在 pcloudy 中检查了印度 Redmi note 6 Pro 设备和 Redmi note 8 pro 设备。通知弹出显示,但在以色列国家相同的设备它不工作。

这是我的电话通知相关通知代码

请检查我的代码,如果有任何解决方案,请在此处发表评论。 android 10 和 11 中的呼叫通知不显示

java`

public void showNotificationForIncomingCall(SipCallSession callInfo) {

        @SuppressWarnings("deprecation")
        int icon = android.R.drawable.stat_sys_phone_call;
        CharSequence tickerText = context.getText(R.string.ongoing_call);
        long when = System.currentTimeMillis();
        Intent callNotifIntent;
        tickerText = context.getText(R.string.incoming_call);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            if (inComingCallNotification == null) {
                inComingCallNotification = new Builder(context);
                inComingCallNotification.setSmallIcon(icon);
                inComingCallNotification.setTicker(tickerText);
                inComingCallNotification.setPriority(NotificationCompat.PRIORITY_HIGH);
                inComingCallNotification.setCategory(NotificationCompat.CATEGORY_CALL);
                inComingCallNotification.setWhen(when);
                inComingCallNotification.setChannelId(IN_CHANNEL_ID);
                inComingCallNotification.setongoing(true);
            }
        } else {
            if (inComingCallNotification == null) {
                inComingCallNotification = new Builder(context);
                inComingCallNotification.setSmallIcon(icon);
                inComingCallNotification.setTicker(tickerText);
                inComingCallNotification.setDefaults(Notification.DEFAULT_ALL);
                inComingCallNotification.setWhen(when);
                inComingCallNotification.setongoing(true);
            }
        }


        RemoteViews notificationLayoutHeadsUp =
                new RemoteViews(
                        context.getPackageName(),R.layout.incoming_call_notification_heads_up);
`notificationLayoutHeadsUp.setTextViewText(R.id.sip_uri,`        formatRemoteContactString(callInfo.getRemoteContact(),callInfo));
//        notificationLayoutHeadsUp.setTextViewText(R.id.incoming_call_info,"Start Forwarding");



        /*if (contactIcon != null) {
            notificationLayoutHeadsUp.setimageViewBitmap(R.id.caller_picture,contactIcon);

       }*/

        Log.d("Notification: ","showNotification: called: ");

        Intent hangupIntent = new Intent(context,NotificationbroadcastReceiver.class);
        String INTENT_CANCEL_CALL_FORWARDING_ACTION = "com.android.cancel_call";

        hangupIntent.setAction(INTENT_CANCEL_CALL_FORWARDING_ACTION);

        Intent startIntent = new Intent(context,NotificationbroadcastReceiver.class);
        String INTENT_START_CALL_FORWARDING_ACTION = "com.android.start_call";
        startIntent.setAction(INTENT_START_CALL_FORWARDING_ACTION);

        PendingIntent hangupPendingIntent =
                PendingIntent.getbroadcast(context,131,hangupIntent,PendingIntent.FLAG_UPDATE_CURRENT);

        PendingIntent startPendingIntent =
                PendingIntent.getbroadcast(
                        context,startIntent,PendingIntent.FLAG_UPDATE_CURRENT);

        notificationLayoutHeadsUp.setonClickPendingIntent(R.id.accept_btn,startPendingIntent);
        notificationLayoutHeadsUp.setonClickPendingIntent(R.id.reject_btn,hangupPendingIntent);

        prefManager.setBackgroundCall(true);
        Intent notificationIntent = SipServiceNew.buildCallUiIntent(context,callInfo);
        PendingIntent contentIntent = PendingIntent.getActivity(context,notificationIntent,0);
    enter code here
        inComingCallNotification.setContentText(formatRemoteContactString(callInfo.getRemoteContact(),callInfo));
        inComingCallNotification.setContentIntent(contentIntent);
        inComingCallNotification.setongoing(true)
//                .setFullScreenIntent(contentIntent,true)
//                .setCustomHeadsUpContentView(notificationLayoutHeadsUp)
                .addAction(R.drawable.cancel_forwarding_bg,"Decline",hangupPendingIntent)
                .addAction(R.drawable.start_forwarding_bg,"Accept",startPendingIntent)
                .setVisibility(Notification.VISIBILITY_PUBLIC);
        Notification notification = inComingCallNotification.build();
        notification.flags |= Notienter code herefication.FLAG_NO_CLEAR;
        notificationmanager.notify(131,notification);
    }

        }
    }

`

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...