728x90
반응형
.setPriority(NotificationCompat.PRIORITY_MAX)
.setDefaults(Notification.DEFAULT_VIBRATE)
를 추가해주면 된다.
풀소스
Intent intent = new Intent(this, chattingMainActivity.class);
intent.putExtra("loginUserId",loginUserId);
intent.putExtra("loginUserNickName",loginUserNick);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Log.d("로그인 아이디 @@@@@",""+loginUserNick);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
PendingIntent.FLAG_CANCEL_CURRENT);
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setLargeIcon(BitmapFactory.decodeResource(getResources(), android.R.drawable.ic_dialog_info))
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle("Helper")
.setContentText(senderNick+"님이 친구신청을"+ title+" 하셨습니다.")
.setAutoCancel(true)
.setPriority(NotificationCompat.PRIORITY_MAX)
.setDefaults(Notification.DEFAULT_VIBRATE)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
728x90
반응형
'Android' 카테고리의 다른 글
(스크랩) Android Firebase FCM Launch Activity 지정하기. (원하는 Activity 실행하기) (0) | 2018.06.29 |
---|---|
Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (0) | 2018.06.26 |
안드로이드 진동 Vibrate (0) | 2018.06.21 |
switch 버튼 색상 바꾸기 (0) | 2018.06.20 |
전화걸기 (0) | 2018.06.20 |