@Implements(value=android.app.NotificationManager.class, looseSignatures=true) public class ShadowNotificationManager extends Object
Constructor | Description |
---|---|
ShadowNotificationManager() |
Modifier and Type | Method | Description |
---|---|---|
protected String |
addAutomaticZenRule(AutomaticZenRule automaticZenRule) |
|
protected boolean |
areNotificationsEnabled() |
|
protected void |
cancel(int id) |
|
protected void |
cancel(String tag,
int id) |
|
protected void |
cancelAll() |
|
protected boolean |
canNotifyAsPackage(String pkg) |
|
protected void |
createNotificationChannel(Object channel) |
|
protected void |
createNotificationChannelGroup(Object group) |
|
protected void |
createNotificationChannelGroups(List<Object> groupList) |
|
protected void |
createNotificationChannels(List<Object> channelList) |
|
protected void |
deleteNotificationChannel(String channelId) |
|
protected void |
deleteNotificationChannelGroup(String channelGroupId) |
Delete a notification channel group and all notification channels associated with the group.
|
StatusBarNotification[] |
getActiveNotifications() |
|
List<Notification> |
getAllNotifications() |
|
protected AutomaticZenRule |
getAutomaticZenRule(String id) |
|
protected Map<String,AutomaticZenRule> |
getAutomaticZenRules() |
|
protected int |
getCurrentInterruptionFilter() |
|
Notification |
getNotification(int id) |
|
Notification |
getNotification(String tag,
int id) |
|
protected Object |
getNotificationChannel(String channelId) |
|
Object |
getNotificationChannelGroup(String id) |
|
protected List<Object> |
getNotificationChannelGroups() |
|
List<Object> |
getNotificationChannels() |
|
protected String |
getNotificationDelegate() |
|
protected NotificationManager.Policy |
getNotificationPolicy() |
|
boolean |
isChannelDeleted(String channelId) |
Checks whether a channel is considered a "deleted" channel by Android.
|
protected boolean |
isNotificationPolicyAccessGranted() |
|
protected void |
notify(int id,
Notification notification) |
|
protected void |
notify(String tag,
int id,
Notification notification) |
|
protected boolean |
removeAutomaticZenRule(String id) |
|
void |
setCanNotifyAsPackage(String otherPackage,
boolean canNotify) |
Sets notification delegate for the package provided.
|
void |
setEnforceMaxNotificationLimit(boolean enforceMaxNotificationLimit) |
Ensures a notification limit is applied before posting the notification.
|
protected void |
setInterruptionFilter(int interruptionFilter) |
Currently does not support checking for granted policy access.
|
protected void |
setNotificationDelegate(String delegate) |
|
protected void |
setNotificationPolicy(NotificationManager.Policy policy) |
Currently does not support checking for granted policy access.
|
void |
setNotificationPolicyAccessGranted(boolean granted) |
Sets the value returned by
NotificationManager.isNotificationPolicyAccessGranted() . |
void |
setNotificationsEnabled(boolean areNotificationsEnabled) |
|
int |
size() |
|
protected boolean |
updateAutomaticZenRule(String id,
AutomaticZenRule automaticZenRule) |
@Implementation protected void notify(int id, Notification notification)
@Implementation protected void notify(String tag, int id, Notification notification)
@Implementation protected void cancel(int id)
@Implementation protected void cancel(String tag, int id)
@Implementation protected void cancelAll()
@Implementation(minSdk=24) protected boolean areNotificationsEnabled()
public void setNotificationsEnabled(boolean areNotificationsEnabled)
@Implementation(minSdk=23) public StatusBarNotification[] getActiveNotifications()
@Implementation(minSdk=26) protected Object getNotificationChannel(String channelId)
@Implementation(minSdk=26) protected void createNotificationChannelGroup(Object group)
@Implementation(minSdk=26) protected void createNotificationChannelGroups(List<Object> groupList)
@Implementation(minSdk=26) protected List<Object> getNotificationChannelGroups()
@Implementation(minSdk=26) protected void createNotificationChannel(Object channel)
@Implementation(minSdk=26) protected void createNotificationChannels(List<Object> channelList)
@Implementation(minSdk=26) public List<Object> getNotificationChannels()
@Implementation(minSdk=26) protected void deleteNotificationChannel(String channelId)
@Implementation(minSdk=26) protected void deleteNotificationChannelGroup(String channelGroupId)
@Implementation(minSdk=23) protected final int getCurrentInterruptionFilter()
NotificationManager.INTERRUPTION_FILTER_ALL
by default, or the value specified
via setInterruptionFilter(int)
@Implementation(minSdk=23) protected final void setInterruptionFilter(int interruptionFilter)
@Implementation(minSdk=23) protected final NotificationManager.Policy getNotificationPolicy()
setNotificationPolicy(Policy)
@Implementation(minSdk=23) protected final boolean isNotificationPolicyAccessGranted()
setNotificationPolicyAccessGranted(boolean)
@Implementation(minSdk=23) protected final void setNotificationPolicy(NotificationManager.Policy policy)
public void setNotificationPolicyAccessGranted(boolean granted)
NotificationManager.isNotificationPolicyAccessGranted()
. If
granted
is false, this also deletes all AutomaticZenRule
s.@Implementation(minSdk=24) protected AutomaticZenRule getAutomaticZenRule(String id)
@Implementation(minSdk=24) protected Map<String,AutomaticZenRule> getAutomaticZenRules()
@Implementation(minSdk=24) protected String addAutomaticZenRule(AutomaticZenRule automaticZenRule)
@Implementation(minSdk=24) protected boolean updateAutomaticZenRule(String id, AutomaticZenRule automaticZenRule)
@Implementation(minSdk=24) protected boolean removeAutomaticZenRule(String id)
@Implementation(minSdk=29) protected String getNotificationDelegate()
@Implementation(minSdk=29) protected boolean canNotifyAsPackage(@NonNull String pkg)
public void setCanNotifyAsPackage(@NonNull String otherPackage, boolean canNotify)
canNotifyAsPackage(String)
will be returned based on this value.
otherPackage
- the package for which the current package can notify on behalfcanNotify
- whether the current package is set as notification delegate for 'otherPackage'@Implementation(minSdk=29) protected void setNotificationDelegate(String delegate)
public void setEnforceMaxNotificationLimit(boolean enforceMaxNotificationLimit)
When set to true a maximum notification limit of 25 is applied. Notifications past this limit are dropped and are not posted or enqueued.
When set to false no limit is applied and all notifications are posted or enqueued. This is the default behavior.
public boolean isChannelDeleted(String channelId)
public int size()
public Notification getNotification(int id)
public Notification getNotification(String tag, int id)
public List<Notification> getAllNotifications()