마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

`알람기능 구현시 소리가 안나고 표시만 되게 할려면 어떻게 수정해야 할가요

0 추천
안녕하세요. 알람기능 구현시 소리가 안나고 표시만 되게 할려면 어떻게 수정해야 할가요.. 읽어 주셔서 감사합니다.
 
private void sendNotification(String messageBody) {
    Intent intent = new Intent(this, MainActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent, PendingIntent.FLAG_ONE_SHOT);

    String channelId = "fcm_default_channel";//getString(R.string.default_notification_channel_id);
    Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder notificationBuilder =
            new NotificationCompat.Builder(this, channelId)
                    .setSmallIcon(R.mipmap.ic_launcher)//drawable.splash)
                    .setContentTitle("Service test")
                    .setContentText(messageBody)
                    .setAutoCancel(true)
                    .setSound(defaultSoundUri)
                    .setPriority(Notification.PRIORITY_HIGH)
                    .setContentIntent(pendingIntent);

중략
오필리아 (750 포인트) 님이 2022년 9월 1일 질문

1개의 답변

0 추천
spark (227,830 포인트) 님이 2022년 9월 2일 답변
...