2
나는 안드로이드 초보자입니다. 내 앱에서 알림을 표시하고 싶습니다. 다음 코드인 텐트를 사용하지 않고 Android에서 알림 표시
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager notificationManager = (NotificationManager) getSystemService(ns);
int icon = R.drawable.icon;
CharSequence tickerText = "";
long when = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText, when);
Context context = getApplicationContext();
CharSequence contentTitle = "Hello";
CharSequence contentText = "Welcome ";
Intent notificationIntent = new Intent();
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, null, 0);
notification.defaults |= Notification.DEFAULT_SOUND;
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
notificationManager.notify(HELLO_ID, notification);
를 사용하지만 내 문제는 아이콘이 상태 표시 줄에 표시가 그 때는 아이콘 의도가로드 내 응용 프로그램을 실행 할 때마다입니다. 인 텐트를 사용하지 않고 알림을 표시하는 방법? 이 당신이 원하는 경우 잘 모르겠어요