Android 我们面临呼叫通知弹出窗口未在Redmi note 6 pro和Redmi note 8 pro设备中显示的问题
我们已经在pcloudy与印度Redmi note 6 Pro设备和Redmi note 8 Pro设备进行了核对。显示通知弹出窗口,但在以色列国家/地区,同一设备不工作 这是我的呼叫通知相关的通知代码 请检查我的代码,如果有任何解决方案,请在这里发表意见。 android 10和11中的呼叫通知不显示 爪哇`Android 我们面临呼叫通知弹出窗口未在Redmi note 6 pro和Redmi note 8 pro设备中显示的问题,android,android-layout,android-notifications,android-studio-3.0,android-notification-bar,Android,Android Layout,Android Notifications,Android Studio 3.0,Android Notification Bar,我们已经在pcloudy与印度Redmi note 6 Pro设备和Redmi note 8 Pro设备进行了核对。显示通知弹出窗口,但在以色列国家/地区,同一设备不工作 这是我的呼叫通知相关的通知代码 请检查我的代码,如果有任何解决方案,请在这里发表意见。 android 10和11中的呼叫通知不显示 爪哇` public void showNotificationForIncomingCall(SipCallSession callInfo) { @SuppressWarn
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, 131, 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, 131, 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);
}
}
}
`