UNPKG

expo-notifications

Version:

Provides an API to fetch push notification tokens and to present, schedule, receive, and respond to notifications.

45 lines • 2.43 kB
import { NotificationPermissionsRequest } from './NotificationPermissions.types'; /** * Calling this function checks current permissions settings related to notifications. * It lets you verify whether the app is currently allowed to display alerts, play sounds, etc. * There is no user-facing effect of calling this. * @return It returns a `Promise` resolving to an object represents permission settings ([`NotificationPermissionsStatus`](#notificationpermissionsstatus)). * On iOS, make sure you [properly interpret the permissions response](#interpret-the-ios-permissions-response). * @example Check if the app is allowed to send any type of notifications (interrupting and non-interrupting–provisional on iOS). * ```ts * import * as Notifications from 'expo-notifications'; * * export async function allowsNotificationsAsync() { * const settings = await Notifications.getPermissionsAsync(); * return ( * settings.granted || settings.ios?.status === Notifications.IosAuthorizationStatus.PROVISIONAL * ); * } * ``` * @header permissions */ export declare function getPermissionsAsync(): Promise<import("./NotificationPermissions.types").NotificationPermissionsStatus>; /** * Prompts the user for notification permissions according to request. **Request defaults to asking the user to allow displaying alerts, * setting badge count and playing sounds**. * @param permissions An object representing configuration for the request scope. * @return It returns a Promise resolving to an object represents permission settings ([`NotificationPermissionsStatus`](#notificationpermissionsstatus)). * On iOS, make sure you [properly interpret the permissions response](#interpret-the-ios-permissions-response). * @example Prompts the user to allow the app to show alerts, play sounds, set badge count and let Siri read out messages through AirPods. * ```ts * import * as Notifications from 'expo-notifications'; * * export function requestPermissionsAsync() { * return await Notifications.requestPermissionsAsync({ * ios: { * allowAlert: true, * allowBadge: true, * allowSound: true, * }, * }); * } * ``` * @header permissions */ export declare function requestPermissionsAsync(permissions?: NotificationPermissionsRequest): Promise<import("./NotificationPermissions.types").NotificationPermissionsStatus>; //# sourceMappingURL=NotificationPermissions.d.ts.map