能否在通知上单击应用程序名称来打开意图?
现在,仅当我单击内容区域时,我才能打开应用程序/意图。
下面是我的通知代码,以防万一。
val notificationIntent = Intent(this, MainActivity::class.java)
notificationIntent.action = ACTION_MAIN
notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER)
notificationIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT or Intent.FLAG_ACTIVITY_SINGLE_TOP
val pendingIntent = PendingIntent.getActivity(this, 1, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT)
val notification = NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID)
.setSmallIcon(R.drawable.ic_logo_path)
.setContentIntent(pendingIntent)
.setOngoing(true)
.build()
startForeground(NOTIFICATION_ID_LOCATION_SERVICE, notification)