Checks the status of the notification permission.
🚨 Android will not respond as "blocked" when checked; instead, you need to make a request to obtain the information.
Example:
let notificationPermissionStatus = await Eitri.notification.checkPermission()
console.log(notificationPermissionStatus)
/* Example output from this console.log:
{ status: "DENIED" }
*/
- API LEVEL
7
- Functionality added
Requests the notification permission.
Example:
let notificationPermissionStatus = await Eitri.notification.requestPermission()
console.log(notificationPermissionStatus)
/* Example output from this console.log:
{ status: "DENIED" }
*/
- API LEVEL
7
- Functionality added
Check the permission status for scheduling local notifications.
Example:
let schedulePermissionStatus = await Eitri.notification.checkSchedulePermission()
console.log(schedulePermissionStatus)
/* Example output from this console.log:
{ status: "DENIED" }
*/
- API LEVEL
20
- Functionality added
Requests the permission for scheduling local notifications.
Example:
let schedulePermissionStatus = await Eitri.notification.requestSchedulePermission()
console.log(schedulePermissionStatus)
/* Example output from this console.log:
{ status: "DENIED" }
*/
- API LEVEL
20
- Functionality added
Schedule local notification on device
Settings in the native app for using the functionality
SCHEDULE_EXACT_ALARM
permission to receive scheduled local notifications for versions above Android 12.<manifest [...]>
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
[...]
</manifest>
func userNotificationCenter(
_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void
){
// you can retrieve the deeplink by accessing the "url" property of the userInfo object
guard let deeplink = response.notification.request.content.userInfo["url"] as? String else { return }
...
}Example:
try {
await Eitri.notification.sendLocalPush({
id: "1",
title: "TITLE",
message: "MESSAGE",
delayInMilliseconds: 1000 * 10,
deeplink: "eitri://run/eitri-doctor"
})
} catch(error) {
console.log("sendLocalPush.error: ", error)
}
- API LEVEL
20
- Functionality added
List pending scheduled notifications.
Example:
let localPushes = await Eitri.notification.listLocalPushes();
console.log(localPushes);
/* Example output from this console.log:
{
schedules: [
{ nextOccurrence: "Feb 14, 2025 4:07:58 PM", notification: {...} },
{ nextOccurrence: "Feb 15, 2025 10:00:00 AM", notification: {...} }
]
}
*/
- API LEVEL
21
- Functionality added
Cancel a specific pending scheduled notification.
Example:
await Eitri.notification.cancelLocalPush({ id: "1" });
- API LEVEL
21
- Functionality added
Generated using TypeDoc