2016-08-01 3 views
0

Android 앱에 다채로운 맞춤 알림을 구현하고 싶습니다.Android 다채로운 알림 사진

나는 색상을 구현하려했지만, 현재로서는 배경색 만 설정할 수 있습니다. 이런 종류의 결과에 도달하고 싶습니다. enter image description here

내 앱의 이미지가 확장되었을 때 알림 사진으로 표시됩니다. 여기

순간에 내 코드 :

return builder.setContentTitle("APP TITLE") 
       .setContentText("Some texts") 
       .setSmallIcon(R.mipmap.ic_launcher) 
       .setContentIntent(pendingIntent) 
       .setOngoing(true) 
       .setAutoCancel(true)   
       .setVisibility(Notification.VISIBILITY_PUBLIC) 
       .setPriority(Notification.PRIORITY_HIGH) 
       .setCategory(Notification.CATEGORY_ALARM) 
       .setOnlyAlertOnce(false) 
       .setColor(getResources().getColor(R.color.colorPrimary)); 

어떻게 내가 위의 게시 행 아웃의 예와 같은 다채로운 아이콘 알림을 구현할 수 있습니까?

답변

1
mNotifyBuilder = new NotificationCompat.Builder(this) 
       .setContentTitle(getResources().getString(R.string.app_name)) 
       .setContentText(messs) 
       .setLargeIcon(bitmap) 
       .setSmallIcon(R.mipmap.hangouts_launcher) 
       .setStyle(new NotificationCompat.BigTextStyle().bigText(message)); 
mNotifyBuilder.setContentIntent(pIntent); 
// Set Vibrate, Sound and Light            
     int defaults = 0; 
     defaults = defaults | Notification.DEFAULT_LIGHTS; 
     defaults = defaults | Notification.DEFAULT_VIBRATE; 
     defaults = defaults | Notification.DEFAULT_SOUND; 
     mNotifyBuilder.setDefaults(defaults); 
     // Set the content for Notification 
     mNotifyBuilder.setContentText(messs); 
mNotificationManager.notify(m, mNotifyBuilder.build());