I have a very strange issue, I am working on Push Notification and it was successfully implemented but when i have used BigTextStyle in Notification to show a long message in notification area with setFullScreenIntent() method then the issue coming up the Notification opening the Activity automatically which is set in PendingIntent.
If I don't use setFullScreenIntent() then notification won't opening Activity automatically the user has to tap or click on Notification to open the Activity set in PendingIntent.
So there are two codes
Without setFullScreenIntent() working fine and not opening Activity automatically:
notification = new NotificationCompat.Builder(context) .setContentTitle("Title") .setContentIntent(resultPendingIntent) .setContentText(message) .setStyle( new NotificationCompat.BigTextStyle() .bigText(message)) .setSmallIcon(R.drawable.ic_launcher) .setAutoCancel(true); NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); manager.notify(1, notification.build());
With setFullScreenIntent() also working fine but opening Activity automatically:-
notification = new NotificationCompat.Builder(context) .setContentTitle("Title") .setContentIntent(resultPendingIntent) .setContentText(message) .setStyle( new NotificationCompat.BigTextStyle() .bigText(message)) .setSmallIcon(R.drawable.ic_launcher) .setFullScreenIntent(resultPendingIntent, true) //Whether true or false same result .setAutoCancel(true); NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); manager.notify(1, notification.build());
Found here. As you can see it immediately launches the intent. I don't really know in what case you wanted to use
setFullScreenIntent()
?A notification won't automatically expand when a static notification is displayed on top (could be custom bar with wifi, bluetooth and sound control)