안드로이드/Java 3

[안드로이드][Java] 알림(Notification) 클릭 시, Activity 이동

알림 클릭 시, 원하는 Activity로 이동하기 위해 PendingIntent를 활용한다. Intent notiIntent = new Intent(this, (클릭 시 이동하려는 Activity).class); PendingIntent notiPendingIntent = PendingIntent.getActivity( this, 0, notiIntent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder notifyBuilder; notifyBuilder = new NotificationCompat.Builder(this, CHANNEL_ID) .// .setFullScreenIntent(notiPendingIntent, false) .//..

[안드로이드][Java] 알림(Notification) 모드 변경

AudioManager를 활용하여 알림(Notification)의 모드 변경 AudioManager mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); if(mAudioManager.getRingerMode() == 0) { //AudioManager.RINGER_MODE_SILENT (무음모드인 경우) } else if(mAudioManager.getRingerMode() == 1) { //AudioManager.RINGER_MODE_VIBRATE (진동모드인 경우) } else if(mAudioManager.getRingerMode() == 2) { //AudioManager.RINGER_MODE_NORMAL (벨 모드인 경..

[안드로이드][Java] 알림(Notification) 구현

알림의 기본 구성 NotificationManager : 알림을 시스템에 발생시키는 SystemService Notification : 알림 구성 정보를 가지는 객체 NotificationCompat.Builder : 알림을 다양한 정보로 생성 NotificationChannel : 알림의 관리 단위 (Android Oreo부터 추가) 결국, Notification 객체에 각종 정보를 담고 이 객체를 NotificationManager로 시스템에 등록 후, getSystemService() 함수를 이용하여 NotificationManager를 얻음 //NotificationManager 객체 획득 (Java) NotificationManager notificationManager = (Notificati..