android-notifications

How to fix: android.app.RemoteServiceException: Bad notification posted from package *: Couldn't create icon: StatusBarIcon

半腔热情 提交于 2019-11-26 02:18:46
问题 I\'m seeing the following exception in crash logs: android.app.RemoteServiceException: Bad notification posted from package com.my.package: Couldn\'t create icon: StatusBarIcon(pkg=com.my.package user=0 id=0x7f02015d level=0 visible=true num=0 ) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1456) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:146) at android.app.ActivityThread.main(ActivityThread.java:5487) at java.lang

Adding button action in custom notification

被刻印的时光 ゝ 提交于 2019-11-26 02:08:59
问题 I have made custom notification and there is a button in that, I want to perform two different functionalities on notification and button click . I look at many links but couldn\'t find the way to add button listener. Can anyone help. Here is my code. Thanks a lot. private void startNotification() { Intent intent; PendingIntent pIntent; RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.mynotification); Context context = getApplicationContext(); NotificationCompat.Builder

Custom notification layouts and text colors

浪尽此生 提交于 2019-11-26 01:46:27
问题 My application shows some notifications, and depending on user preferences it might use a custom layout in a notification. It works well, but there is a small problem -- text colors . Stock Android and almost all manufacturer skins use black text against a light background for notification text, but Samsung doesn\'t: their notification pulldown has a dark background and the text in the default notification layout is white. So this causes a problem: the notifications that don\'t use any fancy

Change Notification Layout

落爺英雄遲暮 提交于 2019-11-26 01:39:26
问题 I decompiled my system music app (from Sony Ericsson for Android GB 2.3.7) because I want to change the notification layout. I found the method which creates the notification with this code: private void sendStatusBarNotification(Track paramTrack) { if (paramTrack != null) { NotificationManager localNotificationManager = (NotificationManager)this.mContext.getSystemService(\"notification\"); String str = paramTrack.getArtist(); if ((str == null) || (str.equals(this.mContext.getString

Push notification works incorrectly when app is on background or not running

ぐ巨炮叔叔 提交于 2019-11-26 00:17:54
问题 I am using Firebase Cloud Messaging to send push notifications. Here is my FirebaseMessageService : public class FireBaseMessageService extends FirebaseMessagingService { @Override public void onMessageReceived(RemoteMessage remoteMessage) { Log.e(\"TAG\", \"From: \" + remoteMessage.getFrom()); Log.e(\"TAG\", \"Notification Message Body: \" + remoteMessage.getData().get(\"CardName\")+\" : \"+remoteMessage.getData().get(\"CardCode\")); sendNotification(remoteMessage.getNotification().getBody()

Notification bar icon turns white in Android 5 Lollipop

元气小坏坏 提交于 2019-11-25 22:34:08
问题 I have an app showing custom notifications. The problem is that when running in Android 5 the small icon in the Notification bar is shown in white. How can I fix this? 回答1: The accepted answer is not (entirely) correct. Sure, it makes notification icons show in color, but does so with a BIG drawback - by setting the target SDK to lower than Android Lollipop! If you solve your white icon problem by setting your target SDK to 20, as suggested, your app will not target Android Lollipop, which

How to change the status bar color in android

匆匆过客 提交于 2019-11-25 21:53:31
问题 First of all it\'s not a duplicate as in How to change the background color of android status bar How do I change the status bar color which should be same as in navigation bar. I want the status bar color to be same as the navigation bar color 回答1: Android 5.0 Lollipop introduced Material Design theme which automatically colors the status bar based on the colorPrimaryDark value of the theme. This is supported on device pre-lollipop thanks to the library support-v7-appcompat starting from

Custom notification layouts and text colors

痴心易碎 提交于 2019-11-25 20:30:28
My application shows some notifications, and depending on user preferences it might use a custom layout in a notification. It works well, but there is a small problem -- text colors . Stock Android and almost all manufacturer skins use black text against a light background for notification text, but Samsung doesn't: their notification pulldown has a dark background and the text in the default notification layout is white. So this causes a problem: the notifications that don't use any fancy layouts show up fine, but the one that uses a custom layout is hard to read because the text is black

Android 4.1: How to check notifications are disabled for the application?

☆樱花仙子☆ 提交于 2019-11-25 18:55:04
Android 4.1 offers the user a check box to disable notifications for a specific application. However, as a developer we have no way to know whether a call to notify was effective or not. I really need to check if the notifications are disabled for the current application but I can't find any setting for that in the API. Is there ever a way to check this setting in the code? Blundell You can't 100% can't. It is asked in this Google I/O 2012 video and the Project lead for the new notifications declares that you can't. Edit 2016 update: Now you can check it, as said in this Google I/O 2016 video