• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Notification: big

surlac

Newbie
Hi!
I wanted to test Big View Notification on my Samsung Galaxy S3 with following code:

Code:
Notification.Builder builder = new Notification.Builder(this);
builder.setSmallIcon(android.R.drawable.btn_star);
builder.setTicker("Android Image downloaded.");
builder.setContentTitle("Android Image downloaded.");
builder.setContentText("View in full screen mode");
builder.setLargeIcon(((BitmapDrawable)getResources().getDrawable(android.R.drawable.ic_lock_lock)).getBitmap());
builder.setAutoCancel(true);

Notification.BigPictureStyle bigPicutureStyle = new Notification.BigPictureStyle(builder);

bigPicutureStyle.bigLargeIcon(((BitmapDrawable)getResources().getDrawable(android.R.drawable.ic_lock_lock)).getBitmap());

bigPicutureStyle.bigPicture(((BitmapDrawable)getResources().getDrawable(android.R.drawable.ic_lock_lock)).getBitmap());
bigPicutureStyle.setBigContentTitle("Android Image downloaded.");
bigPicutureStyle.setSummaryText("Click on the image for full screen preview");

((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE)).notify(01, bigPicutureStyle.build());

But it displays normal notification instead of Big one.
Official doc says:
Big views were introduced in Android 4.1, and they're not supported on older devices.
But I'm running on Android 4.1.2, so it should be supported.
What can be a problem with my device? On emulator it works just fine.
 
OK, got it. The notification is expanded on emulator and minimized on my device by default. So it is necessary to swipe down with 2 fingers to expand the notification to see full contents of Big View.
 
Back
Top Bottom