android-notification-bar

Android Galaxy S4 — Activity that is visible over lock screen

坚强是说给别人听的谎言 提交于 2019-11-27 01:53:55
问题 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

Set Drawable or Bitmap as icon In Notification in Android

点点圈 提交于 2019-11-26 23:13:27
问题 I download a image from server as bitmap and convert it to drawable now i want to use this drawable as notification icon. But i am unable to do that. here is my code: Notification notification = new NotificationCompat.Builder(context) .setContentTitle(title) .setContentText(message) .setContentIntent(intent) .setSmallIcon(bitmap) .setWhen(when) .build(); but icon is a Resources int value so when i used it it gives error. Any help Edit: Now i update my code and now i am doing like that :

non removable notification

家住魔仙堡 提交于 2019-11-26 20:13:09
问题 In my app, there is service running on background. I want to notify user that the service is running. But I need that user cannot delete the notification - by pressing clear button or by swipe it out, in notification bar It means I need to show my notification above Notification area 回答1: This is possible but the way you implement it depends on the API level you develop for. For API levels below 11, you can set Notification.FLAG_NO_CLEAR. This can be implemented like this: // Create

How to set the app icon as the notification icon in the notification drawer

前提是你 提交于 2019-11-26 15:59:49
问题 As shown in the figure... I am getting my notification icon(on left to the red colour). But I need to display the app icon as shown by the black arrow public void notify(View view){ notification.setSmallIcon(R.drawable.ic_stat_name); notification.setTicker("Welcome to ****"); notification.setWhen(System.currentTimeMillis()); notification.setContentTitle("abcd"); notification.setContentText("abcd"); Intent intent = new Intent(this, home.class); PendingIntent pendingIntent = PendingIntent

Disable the notification panel from being pulled down

不打扰是莪最后的温柔 提交于 2019-11-26 15:22:18
I am working on a lockscreen app and I need to disable the ability to pull down the notification/status bar at the top of the screen. There is an app called Holo Locker and what this app does is when the user pulls down from the top of the screen, it just sets the bar back up to the top of the screen and making it impossible to pull the drawer down. I have no idea where to start. Any help would be great! Thanks! Vikram This is possible using reflection. There are plenty of problems though. There's no way to check if the notification panel is open, or opening. So, we'll have to rely on Activity

Click on the Notification programmatically

試著忘記壹切 提交于 2019-11-26 14:39:50
问题 I trying click on the notification after receiving it. I'm able to drag the notification drawer using the Accessibility service. For clicking the notification I'm using accessibilityEvent.getSource() and accessibilityNodeInfo.performAction(AccessibilityNodeInfo.ACTION_CLICK); My code: public class MyAccessibilityService extends AccessibilityService { /** * On receiving the AccessibilityEvent performs the Actions * * @param event */ @Override public void onAccessibilityEvent(AccessibilityEvent

How to create a notification with NotificationCompat.Builder?

随声附和 提交于 2019-11-26 12:59:18
I need to create a simple notification which will be shown in notification bar along with the sound and icon if possible? I also need it to be compatitible with Android 2.2, so i found that NotificationCompat.Builder works with all APIs above 4. If there's a better solution, feel free to mention it. thaussma The NotificationCompat.Builder is the most easy way to create Notifications on all Android versions. You can even use features that are available with Android 4.1. If your app runs on devices with Android >=4.1 the new features will be used, if run on Android <4.1 the notification will be

How can I programmatically open/close notifications in Android?

纵然是瞬间 提交于 2019-11-26 12:00:59
问题 I\'ve searched everywhere, but can\'t find anything in the SDK or on Google on how to do this. I know it\'s possible because all the custom launchers are able to do it via a button press (LauncherPro, ADW, etc). Thanks. 回答1: You can programmatically close the notification drawer by broadcasting an ACTION_CLOSE_SYSTEM_DIALOGS intent. This causes "temporary system dialogs" to be dismissed. From the documentation: Some examples of temporary system dialogs are the notification window-shade and

Load image from url in notification Android

旧城冷巷雨未停 提交于 2019-11-26 10:20:52
问题 In my android application, i want to set Notification icons dynamically which will be loaded from URL. For that, i have used setLargeIcon property of NotificationBuilder in receiver .I reffered many link and tried various solutions but couldn\'t get desired output. Though i downloaded that image from url and setting that bitmap in notification, it is not being displayed. Instead it displays the setSmallIcon image as large icon. I don\'t know where i am going wrong. Here i am posting my code.

How to detect when the notification/system bar is opened

风格不统一 提交于 2019-11-26 10:03:30
问题 I needed to know when the system/notification bar gets opened in my app, and I couldn\'t find any real solutions, so I hacked something together which seems to work pretty well. 回答1: Before I big with the implementation, I will give a brief explanation of my (very hacky) logic. When an Activity is no longer visible to the user for any reason, onWindowFocusChanged(..) gets invoked. However, onStop() only gets invoked when the Activity is no longer visible to the user by going to the background