2
사용자 상호 작용 중에 해당 위치에있는 상태 표시 줄에 맞춤 알림을 보내고 싶습니다. 단지 안드로이드 4 스마트 폰에Andorid : 상태 표시 줄에 지울 수없는 맞춤 알림을 만드는 방법은 무엇입니까?
Notification notification = new Notification(getBatteryStateResource(percent,status), "notify",System.currentTimeMillis());
notification.flags = notification.flags | Notification.FLAG_ONGOING_EVENT;
notification.contentView = new RemoteViews(mContext.getPackageName(), R.layout.statusbar);
Intent intent = new Intent(mContext, Activity.class);
PendingIntent contentIntent = PendingIntent.getActivity(mContext, 0, intent, 0);
notification.contentIntent=contentIntent;
notification.contentView.setOnClickPendingIntent(R.id.imageView, anotherContentIntent);
NotificationManager nm = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(42, notification);
이 코드가 작동 :
은이 코드를 사용합니다. 태블릿에서 알림의 imageView를 클릭 할 때마다 시스템 삭제 알림이 표시됩니다.
대신 Android 2.3 및 2.2에서는 "anotherContentIntent"가 시작되지 않고 "contentIntent"만 시작됩니다. 이유가 무엇입니까?
많은 감사에서 모든 .... FLAG_ONGOING_EVENT
에 추가
많은 감사 .... – Meroelyth