Is possible set Expanded Notification as default in Big Text Notifications?

The documentation states: A notification’s big view appears only when the notification is expanded, which happens when the notification is at the top of the notification drawer, or when the user expands the notification with a gesture. So my answer is no, you can’t expand it by default. There is however a trick to push … Read more

Android – use external profile image in notification bar like Facebook

This statement will use a method to convert a URL (naturally, one that points to an image) into a Bitmap. Bitmap bitmap = getBitmapFromURL(“https://graph.facebook.com/YOUR_USER_ID/picture?type=large”); Note: Since you mention a Facebook profile, I have included an URL that gets your the large size profile picture of a Facebook User. You can however, change this to any … Read more

How to implement the deprecated methods of Notification

This is how i ended up to the solution: if (currentapiVersion < android.os.Build.VERSION_CODES.HONEYCOMB) { notification = new Notification(icon, text, time); notification.setLatestEventInfo(this, title, text, contentIntent); // This method is removed from the Android 6.0 notification.flags |= Notification.FLAG_AUTO_CANCEL; mNM.notify(NOTIFICATION, notification); } else { NotificationCompat.Builder builder = new NotificationCompat.Builder( this); notification = builder.setContentIntent(contentIntent) .setSmallIcon(icon).setTicker(text).setWhen(time) .setAutoCancel(true).setContentTitle(title) .setContentText(text).build(); mNM.notify(NOTIFICATION, notification); … Read more

Different notification sound not working in Oreo

Problem: It seems Notification Channel issue. Solution: Either you should create separate channel, or you should delete your own channel. Strategy: 1) Create separate channel: You may select this strategy if you want to persist multiple channels along with various configuration for your app. To create separate channel, just provide unique channel ID while creating … Read more

Bad notification posted – Couldn’t expand RemoteViews for: StatusBarNotification

For me, the problem was that I was setting a specific height for the root layout, in the custom notification view xml file. As soon as I changed: android:layout_height=”@dimen/notification_expanded” to android:layout_height=”match_parent” in the root layout of notification view, the problem was solved. Also take a look at this example to see a simple example of … Read more

How to open fragment page, when pressed a notification in android

If you are using Navigation Component you can open a specific destination using NavDeepLinkBuilder: val pendingIntent = NavDeepLinkBuilder(context) .setComponentName(MainActivity::class.java) .setGraph(R.navigation.nav_graph) .setDestination(R.id.destination) .setArguments(bundle) .createPendingIntent() … notificationBuilder.setContentIntent(pendingIntent) … Please note that it’s important to use setComponentName only if your destination isn’t in the launcher activity.

PendingIntent is not working on Android O

Never use an implicit Intent when an explicit Intent will do. Android O helps enforce this by banning the receipt of implicit Intent broadcasts from manifest-registered receivers. Step #1: Remove the <intent-filter> from your <receiver> (which also means that you could get rid of android:exported=”false”, as that is now the default value) Step #2: Replace … Read more