안드로이드에서 알림음
조회수 4410회
새로나온 NotificationCompat builder를 써봤는데요. 진동하고 LED알림 표시는 했는데 알림음을 낼수가 없어요. 안드로이드 문서에 보면 스타일을 제가 지정하고싶은데로 할수있다는데
builder.setStyle(new NotificationCompat.InboxStyle());
소리는 못하나요?
소스코드
NotificationCompat.Builder builder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("Notifications Example")
.setContentText("This is a test notification");
Intent notificationIntent = new Intent(this, MenuScreen.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(contentIntent);
builder.setAutoCancel(true);
builder.setLights(Color.BLUE, 500, 500);
long[] pattern = {500,500,500,500,500,500,500,500,500};
builder.setVibrate(pattern);
builder.setStyle(new NotificationCompat.InboxStyle());
// Add as notification
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(1, builder.build());
댓글 입력