android-notification-bar

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

独自空忆成欢 提交于 2019-11-29 22:01:17
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 4.4. However, in Android 5.0 the icon showed in status bar is a white square. The icon showed in the

Android notification bar open last active activity?

允我心安 提交于 2019-11-29 21:06:49
问题 I am creating like timer application and when I start timer I have option to go to android Home or start any other activity . When I start timer I set a notification bar icon and if i use some other application (mean go from started timer activity) and now I need to go to back to my previously started timer activity by clicking on notification icon ??? When I click I am starting a new instance timer activity , not the previously started timer activity ! , and if I then click back button it

Android: Multiple Alarm not working

流过昼夜 提交于 2019-11-29 15:46:17
问题 In My application i have set the two alarm. On toogleButton on i am going to set it on with below code: case R.id.toggleButtonTwoMonth: myPrefs = this.getSharedPreferences("myPrefs",MODE_WORLD_WRITEABLE); if (tButtonTwoMonth.isChecked()) { Toast.makeText(getApplicationContext(), "Two months reminder is On", Toast.LENGTH_SHORT).show(); prefsEditor = myPrefs.edit(); prefsEditor.putBoolean("TwoMonth", true); prefsEditor.commit(); //For Broadcast Alarm Intent in = new Intent(this,

How to count number of notification and display single icon in Android?

…衆ロ難τιáo~ 提交于 2019-11-29 13:00:09
问题 I have multiple Android notification, but when I send a message from my web server, the android device creates a new notification icon on status bar. I want to count the number of unread notification, display it on statusbar with single icon, and when a notification is read, the notification has to change the number of unread notification count. How can I do it? It's look like "3 Others" in this image: Notification Icon 回答1: Check out the answer here: How to give counter if more than one

Default notification background color

帅比萌擦擦* 提交于 2019-11-29 07:40:24
I have a custom notification that uses a LinearLayout that contains an ImageView and a TextView . Before Android 4.0 all I needed to do was swap out the text colors with the EventContent and EventContent.Title styles and all the colors looked great. But on Android 4.0 (Ice Cream Sandwich) my custom notification background color is a light gray, and to make matters worse it clashes horribly with the default text styles. This is strange to me, since all the other notifications have a dark-gray (almost black) color, and I haven't changed the background color at all in my layout. Is there a way to

Android: How can I put my notification on top of notification area?

牧云@^-^@ 提交于 2019-11-28 21:16:16
I'm trying to put my notification on top of notification area. A solution is to set the parameter "when" to my notification object with a future time like: notification.when = System.currentTimeMills()*2; The code that I'm using in this: long timeNotification = System.currentTimeMillis()*2; Notification notification = new Notification(statusIcon,c.getResources().getString(R.string.app_name),timeNotification); notification.flags = Notification.FLAG_ONGOING_EVENT | Notification.FLAG_NO_CLEAR; notification.when = timeNotification; notification.priority = Notification.PRIORITY_MAX; but some apps

Android Galaxy S4 — Activity that is visible over lock screen

拥有回忆 提交于 2019-11-28 07:37:52
A few years ago, I wrote an alarm app that worked on Android 2, and I'm now trying to upgrade it to work on Android 4. Specifically, on the Samsung Galaxy S4. On Android 2, if the phone was sleeping, it would wake the phone up and display a "Snooze or Dismiss" screen over the lock screen. On Android 4, it wakes the phone up, but you have to unlock it, then open the notifications area, then click the alarm's notification, before you can hit "Dismiss." I have always been using this code to do the waking: getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager

How to download file/image from url to your android app

五迷三道 提交于 2019-11-28 05:43:30
问题 I need my android app to make request to url to download an image from this url so I have built this class to help me, BUT it didn't work ??? public class MyAsnyc extends AsyncTask<Void, Void, Void> { public static File file; InputStream is; protected void doInBackground() throws IOException { File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); file = new File(path, "DemoPicture.jpg"); try{ // Make sure the Pictures directory exists. path.mkdirs(); URL

Listen to incoming Whatsapp messages/notifications

喜夏-厌秋 提交于 2019-11-28 03:50:30
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"? I was able to do this using Accessibility Service . Using this, you can listen to all notification on the notification bar. I listened to application-specification by adding the package name to the Accessibility Service service info ,

Default notification background color

非 Y 不嫁゛ 提交于 2019-11-28 01:18:04
问题 I have a custom notification that uses a LinearLayout that contains an ImageView and a TextView . Before Android 4.0 all I needed to do was swap out the text colors with the EventContent and EventContent.Title styles and all the colors looked great. But on Android 4.0 (Ice Cream Sandwich) my custom notification background color is a light gray, and to make matters worse it clashes horribly with the default text styles. This is strange to me, since all the other notifications have a dark-gray