android-notification-bar

App crashes onResume when canceling Notification

蹲街弑〆低调 提交于 2020-01-16 01:55:06
问题 I try to cancel my Notification in onResume() but it crashes: With displayNotification() i create the Notification. I also tried to set the cancelNotification() in a try catch. But this doesn't solve the problem. But without i can't even start the app to generate the Notification. Here are my Codesnippets: OnResume: @Override protected void onResume() //activity was resumed and is visible again { Log.d(logtag,"onResume() called"); super.onResume(); cancelNotification(); } cancelNotification()

How to show a Notification on Oreo?

蓝咒 提交于 2020-01-11 14:37:12
问题 Notification doesn't shown on above V26 API.Notification cshown on v25 but when i checked it on v27 than the notification doesn't appear. My code to StartService and create notification. Inside Mainctivity onCreate() Intent intent1 = new Intent(this, NotificationService.class); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { ContextCompat.startForegroundService(this, intent1); } else { startService(intent1); } NotificationService extends Service onCreateMethod i call the method

Hidden notification bar reappearing after screen lock and unlock

不打扰是莪最后的温柔 提交于 2020-01-04 14:18:08
问题 I hid my notification bar for my activity by changing the theme to Theme.NoTitlebar.FullScreen and then changed it in my manifest too. I successfully hid the notification bar. But if I lock and then again unlock the screen when in the same activity, the notification bar becomes visible. How do I overcome this? I want to hide my notification bar throughout my activity. 回答1: I have same problem when I use TabHost. Here are a workaround for this problem: @Override public void

Urban Airship: custom icon for default status bar notification

a 夏天 提交于 2020-01-02 05:34:09
问题 Urban Airship recommends creating a custom notification with CustomPushNotificationBuilder if you want to make any modifications to the status bar notification, including trivially changing the icon. Unfortunately, using a RemoteView for notifications carries many unwanted implications with it related to custom manufacturer and/or platform-specific skins, including text colors and references to private resources (for instance @*android:drawable/notify_panel_notification_icon_bg_tile on

How can I keep the action/title bar but hide the notification bar

∥☆過路亽.° 提交于 2019-12-23 12:46:37
问题 How can I keep the action/title bar but hide the notification bar? This question looks like it has already been answered but most of the answers I found hide both the action bar and the notification bar. I want to be able to keep the action/title bar. The best I've gotten is hiding both and using a linear layout to display a custom action/title bar but I want a system generated one. Also is it possible to hide just the action bar whilst displaying the notification bar? 回答1: To hide the

How to add a Dynamic image instead of notification icon in android?

爷,独闯天下 提交于 2019-12-20 01:08:23
问题 I used below code for displaying notification in notification Bar. it worked fine. But i need to display notification icon dynamically that will come from web service. How i can do? NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); Notification note = new Notification(R.drawable.image,"status message", System.currentTimeMillis()); Intent in = new Intent(Notify.this,CommentU.class); PendingIntent pi = PendingIntent.getActivity(Notify.this, 0, in, 0); note

putExtra using pending intent not working

穿精又带淫゛_ 提交于 2019-12-18 12:48:00
问题 I have written a code in my GCMIntentservice that sends push notifications to many users. I use the NotificationManager that will call DescriptionActivity class when the notification is clicked. I also send the event_id form the GCMIntentService to the DescriptionActivity protected void onMessage(Context ctx, Intent intent) { message = intent.getStringExtra("message"); String tempmsg=message; if(message.contains("You")) { String temparray[]=tempmsg.split("="); event_id=temparray[1]; } nm=

Why do icons set with Notification.Builder.setSmallIcon in Android Lollipop show as a white square?

橙三吉。 提交于 2019-12-18 10:28:07
问题 I have this code: Notification notif; // Build notification Notification.Builder notifBuilder = new Notification.Builder(context); notifBuilder.setContentIntent(pendingIntent); notifBuilder.setContentTitle(title); notifBuilder.setSmallIcon(icon_resId); notifBuilder.setContentText(ne.getCaption()); notifBuilder.setDefaults(Notification.DEFAULT_ALL); notifBuilder.setAutoCancel(autocancel); notifBuilder.setWhen(System.currentTimeMillis()); notif = notifBuilder.build(); and works fine in Android

Listen to incoming Whatsapp messages/notifications

ぃ、小莉子 提交于 2019-12-17 17:33:33
问题 I'm working on a notification based app, for which I need to listen to incoming notifications. I've been able to listen to incoming calls, SMS, mail etc. I have no clue how to listen for pings or messages from friends on Whatsapp via code. Can this actually be done? If so, how? Can Accessibility Service be used for this, using Package Name as "com.whatsapp"? 回答1: I was able to do this using Accessibility Service . Using this, you can listen to all notification on the notification bar. I

Android: show notification bar on downloading application

无人久伴 提交于 2019-12-17 16:43:21
问题 I want to show a notification bar when an application is being downloaded in Android. I want the bar to be the same as the one showed when an application is downloaded from market. any help please? 回答1: I think this link can help you: http://united-coders.com/nico-heid/show-progressbar-in-notification-area-like-google-does-when-downloading-from-android This is the download_progress (and to change the style of the progress bar, use your own android:progressDrawable ) <RelativeLayout xmlns