0
Android에서 실행 가능한 알림을 개발 중입니다.Android - 알림 표시 줄에 작업을 표시 할 수 없습니다.
void createActionableNotification() {
Intent intent = new Intent(this, MainActivity.class);
PendingIntent pIntent = PendingIntent.getActivity(this, (int) System.currentTimeMillis(), intent, 0);
// Build notification
// Actions are just fake
Notification noti = new NotificationCompat.Builder(this)
.setContentTitle("New mail from " + "[email protected]")
.setContentText("Subject").setSmallIcon(R.drawable.moneybag)
.setContentIntent(pIntent)
.addAction(R.drawable.moneybag, "Call", pIntent)
.addAction(R.drawable.moneybag, "More", pIntent)
.addAction(R.drawable.moneybag, "And more", pIntent).build();
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
// hide the notification after its selected
noti.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(0, noti);
}
그래서 동작을 표시합니다. 아래 이미지를 확인하십시오. 앱이 대상 SDK와 함께 실행 해있다
는, 컴파일 SDK의 API (24)이며, 최소 SDK는 20 내가 마시 멜로 장치 테스트입니다. 하지만 에뮬레이터에서는 잘 작동합니다. 에뮬레이터 SDK 버전은 24
. 나는 Priority and setwhen (0)도 시도했다. 그러나 변화는 없습니다. 내 전화에 계속 알림이 없습니다. @ rafsanahmad007 – Roster
알림에 스타일을 추가해보십시오. '.setStyle (새 NotificationCompat.BigTextStyle(). bigText (th_alert))' – rafsanahmad007
다음을 참조하십시오. http://stackoverflow.com/questions/ 13720670/구현 - 확장 및 축소 알림 - android – rafsanahmad007