jwiegley / alert

A Growl-like alerts notifier for Emacs
Other
443 stars 67 forks source link

Support for Native Emacs Android Port #111

Open danijelcamdzic opened 10 months ago

danijelcamdzic commented 10 months ago

This MR adds support for android-notifications-notify to be used for the native Emacs Android port.

From the documentation of android-notifications-notify:

android-notifications-notify is a built-in function in ‘C source
code’.

(android-notifications-notify &rest ARGS)

Display a desktop notification.
ARGS must contain keywords followed by values.  Each of the following
keywords is understood:

  :title        The notification title.
  :body         The notification body.
  :replaces-id  The ID of a previous notification to supersede.
  :group        The notification group, or nil.
  :urgency      One of the symbols ‘low’, ‘normal’ or ‘critical’,
                defining the importance of the notification group.
  :icon         The name of a drawable resource to display as the
                notification’s icon.

The notification group and urgency are ignored on Android 7.1 and
earlier versions of Android.  Outside such older systems, it
identifies a category that will be displayed in the system Settings
menu.  The urgency provided always extends to affect all notifications
displayed within that category.  If the group is not provided, it
defaults to the string "Desktop Notifications".

The provided icon should be the name of a "drawable resource" present
within the "android.R.drawable" class designating an icon with a
transparent background.  If no icon is provided (or the icon is absent
from this system), it defaults to "ic_dialog_alert".

When the system is running Android 13 or later, notifications sent
will be silently disregarded unless permission to display
notifications is expressly granted from the "App Info" settings panel
corresponding to Emacs.

A title and body must be supplied.  Value is an integer (fixnum or
bignum) uniquely designating the notification displayed, which may
subsequently be specified as the ‘:replaces-id’ of another call to
this function.

Example test:

Screenshot_20240106-125414