Вопрос по android – Android 4: нельзя отклонить уведомление, проводя

10

Error: User Rate Limit Exceeded

int icon = R.drawable.notification;
CharSequence tickerText = "Text";
long when = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText, when);

Context context = getApplicationContext();
CharSequence contentTitle = "Text";
CharSequence contentText = "Text";
Intent notificationIntent = new Intent(this, RequestActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);

notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
notification.flags |= Notification.DEFAULT_SOUND;
notification.flags |= Notification.DEFAULT_VIBRATE;
notification.flags |= Notification.DEFAULT_LIGHTS;
notification.flags |= Notification.FLAG_AUTO_CANCEL;

mNotificationManager.notify(notificationID, notification);

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded James
Error: User Rate Limit Exceeded Basic Coder
Error: User Rate Limit Exceeded Basic Coder
Error: User Rate Limit Exceeded Basic Coder
Error: User Rate Limit Exceeded James

Ваш Ответ

3   ответа
13

First the solution:

notification.defaults |= Notification.DEFAULT_SOUND;
notification.defaults |= Notification.DEFAULT_VIBRATE;
notification.defaults |= Notification.DEFAULT_LIGHTS;
notification.flags |= Notification.FLAG_AUTO_CANCEL;

And now the reason why it was ongoing?

2.

Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
0

// Will show lights and make the notification disappear when the presses it
notification.flags == Notification.FLAG_AUTO_CANCEL | Notification.FLAG_SHOW_LIGHTS;
5

Set whether this is an "ongoing" notification. Ongoing notifications cannot be dismissed by the user, so your application or service must take care of canceling them. They are typically used to indicate a background task that the user is actively engaged with (e.g., playing music) or is pending in some way and therefore occupying the device (e.g., a file download, sync operation, active network connection).

.setOngoing(false);

Похожие вопросы