android-notification-bar

How to show notification in status bar?

本秂侑毒 提交于 2019-12-07 04:26:19
问题 So i have created this notification in my activity Notification n = new Notification.Builder(getApplicationContext()) .setContentTitle("New mail from " + sender) .setContentText(subject) .setSmallIcon(R.drawable.notification) .build(); How can i now show it in status/notification bar along with the sound? 回答1: There is some good documentation at android developer site and have a look at the NotificationManager doc's Here you go, some code...: NotificationManager mNotificationManager =

Can I force expand android notification on android 4.1+? [closed]

霸气de小男生 提交于 2019-12-06 19:42:25
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I wonder if I could force expand my notification which have 2 buttons, because I don't think users will find them if they are not expanded. Poweramp seems achieved that, anyone please help me. thx in advance. 回答1: As far as I know, the first notification in the notification tray is always presented with the

Notification bar click to close app

本秂侑毒 提交于 2019-12-06 17:09:22
问题 How can I close app when user clicks on text in notification bar without displaying any window? 回答1: Use the following code and register broadcast receiver in your activity : NotificationManager mNotificationManager = (NotificationManager)_context.getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = new Notification(R.drawable.icon,"",System.currentTimeMillis()); notification.flags = Notification.FLAG_AUTO_CANCEL; Context context = _context.getApplicationContext(); /**

Get text from expanded notification in status bar?

允我心安 提交于 2019-12-05 13:53:21
Is it possible to get the text within an expanded notification in the statusbar ? This means text set my Notification.BitTextStyle.bigText() , such as in an email notification from Gmail. I would like to get it using Notification.extras but there seems to be no constant, such as Notification.EXTRA_BIG_TEXT for example, that allows this to work. Is there another way of getting this text? Furthermore when I use String bigTitle = mExtras.getString(Notification.EXTRA_TITLE_BIG; it returns null , any idea why? I use this to get the subject of the email ( Testing the new Gmail notification shortcuts

Oreo Notification Bar Round Icon

柔情痞子 提交于 2019-12-05 06:52:19
I want to know that how can I change the notification bar small icon in android Oreo (API 26). It has round white icon showing in the notification bar. How can I change it? Manifest file default notification icon set as below. <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_status" /> See the image below Remove <meta-data> tag from AndroidManifest.xml . Notification Builder has .setSmallIcon(int icon, int level) which accepts icon as a compulsory argument & level parameter as an optional argument. NOTE: .setSmallIcon accepts

How to show notification in status bar?

∥☆過路亽.° 提交于 2019-12-05 06:01:22
So i have created this notification in my activity Notification n = new Notification.Builder(getApplicationContext()) .setContentTitle("New mail from " + sender) .setContentText(subject) .setSmallIcon(R.drawable.notification) .build(); How can i now show it in status/notification bar along with the sound? There is some good documentation at android developer site and have a look at the NotificationManager doc's Here you go, some code...: NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); // mId allows you to update the notification

Smooth transition between full-screen-activity and one with notification-bar and action bar

坚强是说给别人听的谎言 提交于 2019-12-05 04:11:58
Background I have an app that has 2 activities : splash activity, which is shown in full screen (no action bar, no notification bar) main activity, which has both action bar (uses actionBarSherlock) and notification bar. The problem For some reason, when going from the first activity to the second, there is a "jumpy" layout process , which shows the content of the second activity without the action bar and notification bar, and a moment later it shows them both. This causes the content below to move too, which is very noticeable. Possible solution As I've seen, a possible solution would be to

Can I force expand android notification on android 4.1+? [closed]

怎甘沉沦 提交于 2019-12-05 00:57:29
I wonder if I could force expand my notification which have 2 buttons, because I don't think users will find them if they are not expanded. Poweramp seems achieved that, anyone please help me. thx in advance. As far as I know, the first notification in the notification tray is always presented with the expanded view by default (if a BigView is defined for the notification). So, what you could do is increase the priority of your notification so that it becomes the first notification in the tray, and that way, it will always be expanded by default. mNotification.priority = Notification.PRIORITY

Why does the “download completed” notification disappear on Gingerbread devices?

自作多情 提交于 2019-12-04 23:05:45
I'm using the DownloadManager class to programatically download a file. All works fine but I can't get the download completed notifcation to persist. It disappears immediately once the download has completed. Here's my code: Request rqtRequest = new Request(Uri.parse(((URI) vewView.getTag()).toString())); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) { rqtRequest.setShowRunningNotification(true); } else { rqtRequest.setNotificationVisibility(Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); } ((DownloadManager) getSystemService(DOWNLOAD_SERVICE)).enqueue(rqtRequest); I've

Notification bar click to close app

隐身守侯 提交于 2019-12-04 21:11:39
How can I close app when user clicks on text in notification bar without displaying any window? Use the following code and register broadcast receiver in your activity : NotificationManager mNotificationManager = (NotificationManager)_context.getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = new Notification(R.drawable.icon,"",System.currentTimeMillis()); notification.flags = Notification.FLAG_AUTO_CANCEL; Context context = _context.getApplicationContext(); /** Set the intent extras to be passed to calling activity*/ Intent notificationIntent = new Intent("action