I am working in an android app Notifications . I am able to get the Notifications perfectly but Unable to display an image on Notification. The Notification was as shown in the below .
this is my Build.gradle File
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.ex.myfile"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "2.5"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
I followed the below Dimentions
24 × 24 (mdpi)
36 × 36 (hdpi)
48 × 48 (xhdpi)
72 × 72 (xxhdpi)
96 × 96 (xxxhdpi)
and My Code was
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder;
notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.notification_icon)
.setContentTitle(getString(R.string.app_name))
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);
if (jsonobj.has("streamURL")) {
notificationBuilder.setContentText(jsonobj.getString("userName") + " is LiveNow");
} else if ((jsonobj.has("title") && (jsonobj.has("message")))) {
notificationBuilder.setContentText(allFilesDataModel.getFileTitle() + " " + allFilesDataModel.getMessage());
} else {
notificationBuilder.setContentText("new Video was Uploaded To YouTube");
}
// notificationBuilder.setContentText("" + allFilesDataModel.getFileApprovedOrDenied());
NotificationManager notificationManager = (NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build());
NOTIFICATION_ID++;
}