Android

안드로이드 노티피 케이션 해드업 알림

Machine_웅 2018. 6. 23. 15:51
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());

 

 



head.gif

728x90
반응형