From the NotificationCompat.BigTextStyle documentation:
Helper class for generating large-format notifications containing a lot of text. If the platform does not provide widescreen notifications, this method has no effect . The user will always see a regular notification.
Your platform may not support widescreen notifications.
EDIT:
On the other hand, maybe your problem is here:
NotificationCompat.BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle(); bigTextStyle.bigText(extras.getString("message"));
You are not using the return value of bigText .
Try changing it to:
NotificationCompat.BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle(); bigTextStyle = bigTextStyle.bigText(extras.getString("message"));
or:
NotificationCompat.BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle().bigText(extras.getString("message"));
EDIT2:
Cost notification layout for older versions of Android:
protected void onMessage(Context context, Intent intent) { // Extract the payload from the message Bundle extras = intent.getExtras(); if (extras != null) { String message = (String) extras.get("message"); String title = (String) extras.get("title"); // add a notification to status bar NotificationManager mManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); Intent myIntent = new Intent(this,MyActivity.class); Notification notification = new Notification(R.drawable.notification_image, title, System.currentTimeMillis()); notification.flags |= Notification.FLAG_AUTO_CANCEL; RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.custom_notification); contentView.setImageViewResource(R.id.image, R.drawable.notification_image); contentView.setTextViewText(R.id.title, title); contentView.setTextViewText(R.id.text, message); notification.contentView = contentView; notification.contentIntent = PendingIntent.getActivity(this.getBaseContext(), 0, myIntent, PendingIntent.FLAG_CANCEL_CURRENT); mManager.notify(0, notification); PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); WakeLock wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "TAG"); wl.acquire(15000); } }
Eran source share