android-notifications

Android O - Single line Notification - like the “Android System - USB charging this device”

感情迁移 提交于 2019-12-03 01:11:53
I would like to have an ongoing notification for my ForegroundService that requires as small place as possible. I like the "Android System - USB charging this device" style, but I cannot find any example how to achieve this. Can anyone point me in the right direction? Update The style is given to the notification if the channel is assigned the importance IMPORTANCE_MIN . It looks like there is no way to use Androids built in style for notifications of IMPORTANCE_MIN to be used with a ForegroundService . Here is the description of IMPORTANCE_MIN : Min notification importance: only shows in the

Cant get AlarmManager and Multiple Notifications to work

牧云@^-^@ 提交于 2019-12-02 22:56:53
问题 Ok.. I'm trying to figure out three problems. I am unable to make AlarmManager notify me I want to display a different message for each notifier I will be glad if anyone can help me out, I'm not posting this here just so I can get the code, I have been at it for 2 days so I thought I'd ask the experts here. If I can find someone who would check the below code, show my wrongs and point me in the direction to rectify those wrongs.. Thank yhu. Here is my Notifier class where I set the days and

Notification with “null” PendingIntent

╄→гoц情女王★ 提交于 2019-12-02 22:29:35
I'm trying to implement notification in Android. Now I have a problem, I don't want to have a PendingIntent that user will open any Activity . How can I do that? PendingIntent contentIntent = PendingIntent.getActivity( getApplicationContext(), 0, new Intent(), // add this PendingIntent.FLAG_UPDATE_CURRENT); micrometal The following works and seems more straightforward: PendingIntent pi = PendingIntent.getActivity(context, 0, null, 0); Having a notification without launching a subsequent Activity seems quite sensible to me - eg "Its time to get up!. 来源: https://stackoverflow.com/questions

How to properly update a notification post api 11?

和自甴很熟 提交于 2019-12-02 21:44:40
Before Notification.Builder came into existence the way to update a notification that was already in the notification tray was to call setLatestEventInfo() and then send the notification back through the NotificationManager.notify() call with an ID that matches the first notify() call you made. Now setLatestEventInfo() is deprecated with the message: Use Notification.Builder instead. But I cannot find any documentation about how to properly update a notification using Notification.Builder . Are you just suppose to recreate a new Notification instance every time you need to update the

Prevent user from dismissing notification

核能气质少年 提交于 2019-12-02 21:01:21
Some apps have notifications which can´t be dismissed by swiping them away. How can I manage such behaviour? Marian Klühspies In addition to Andro Selvas answer: If you are using the NotificationCompat.Builder , just use builder.setOngoing(true); Use the flag, FLAG_ONGOING_EVENT to make it persistent. Notification notification = new Notification(icon, tickerText, when); notification.flags = Notification.FLAG_ONGOING_EVENT; Also you can check, FLAG_NO_CLEAR I used the below code to make my notification persistent: startForeground(yourNotificationId,notificationObject); To make it dismissable,

Show ongoing notifications in Android Wear

扶醉桌前 提交于 2019-12-02 20:43:43
I've been playing around with Android Wear and making some dummy apps. What I've noticed is that Android Wear doesn't seem to show the notifications that are ongoing,i.e., notifications with setOngoing(true) . Any way to show these notifications on Wear??? On-going notifications will not show up on Wearable devices. Instead you have to implement a Wear App on the wearable and show cards from there. barkside's answer is correct. I recently wrote an article describing the steps in details, but basically: Create a wearable app with a service implementing WearableListenerService. Send a data item

Android notfication BigPictureStyle disappearing text

孤人 提交于 2019-12-02 20:38:10
I'm being implementing Android rich notifications using the compatibility library, so all my notifications are being built using android.support.v4.app.NotificationCompat.Builder the code I'm using is the following: // Base notification NotificationCompat.Builder b = new NotificationCompat.Builder(context); b.setSmallIcon(R.drawable.ic_actionbar); b.setContentTitle(title); b.setContentText(Html.fromHtml(msg)); b.setTicker(title); b.setWhen(System.currentTimeMillis()); b.setDeleteIntent(getDismissNotificationsPendingIntent(quantity)); b.setLargeIcon(Picasso.with(context).load(iconUrl).get()); /

android notification in background if app closed?

风流意气都作罢 提交于 2019-12-02 20:34:55
I am trying to display a notification in the Android notifications bar even if my application is closed. I've tried searching, but I have had no luck finding help. An example of this is a news application. Even if the phone screen is off or the news application is closed, it can still send a notification for recent news and have it appear in the notification bar. How might I go about doing this in my own application? Idipaolo You have to build a Service that handles your news and shows notifications when it knows that are new news ( Service Doc ). The service will run in background even if

Broadcast receiver, check a checkbox preference state on bootup then send a notification

我的未来我决定 提交于 2019-12-02 20:14:08
问题 My problem is that when I try to read a checkbox preference state from a different activity on bootup then send a status bar notification. Then when the device boots the I get a force close error message popup then when I go into the error log I don't understand what happens. The code for the broadcast receiver is shown below: @Override public void onReceive(Context context, Intent intent) { if(intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){ //this creates a reference to my

Possible to make an Android Notification that does not call an Intent? [closed]

不想你离开。 提交于 2019-12-02 20:06:55
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I need to put a Notification in the Status bar while my app is running, but I don't want it to call back to my Activity if selected.