我在班上的擴展沒有方面NotificationCompat.Builder
int icon = R.drawable.ic_launcher;
long when = System.currentTimeMillis();
myNotification = new NotificationCompat.Builder(context)
.setSmallIcon(icon)
.setContentTitle(context.getResources().getString(R.string.app_name))
.setContentText(context.getResources().getString(R.string.app_name))
.setWhen(when)
.setTicker(context.getResources().getString(R.string.app_name))
.setDefaults(Notification.FLAG_NO_CLEAR);
,然後我通過RemoteViews和最終
Intent notificationIntent = new Intent(context, Menu_Activity.class);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
contentView.setOnClickPendingIntent(R.id.layoutNotification, contentIntent);
myNotification.setContent(remoteView);
myNotification.setOngoing(false);
myNotification.setAutoCancel(false);
myNotification.setPriority(Notification.PRIORITY_HIGH);
myNotification.setContentIntent(contentIntent);
myNotificationManager.notify(NOTIFICATION_ID, myNotification.build());
發送一些DATAS構造函數發送,但我需要設置此通知,將其無法通過將其滑動到側面進行刪除。現在每次我都可以通過滑動刪除它。如何禁用?
謝謝
你是否試圖設置正在進行'真'? – yugidroid